Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

This manual is preliminary and incomplete.
While our Core implementation implements all functions given in the standard we are still working on completing this documentation.

Please refer to the VSIPL standard for a complete function reference of the Core profile until we have completed work on this documentation.

5.2.8 vsip_dcorrelate1d_p - Compute 1D Correlation

typedef enum _visp_bias { 
  VSIP_BIASED   = 0, 
  VSIP_UNBIASED = 1 
} vsip_bias; 
 
void vsip_correlate1d_f(const vsip_corr1d_f *cor, vsip_bias bias, const vsip_vview_f *h, const vsip_vview_f *x, const vsip_vview_f *y); 
void vsip_ccorrelate1d_f(const vsip_ccorr1d_f *cor, vsip_bias bias, const vsip_cvview_f *h, const vsip_cvview_f *x, const vsip_cvview_f *y);
Description

This function computes the one-dimensional correlation between an input signal x and a reference signal h using the pre-configured correlation object. The result is stored in the output vector y. The correlation operation computes:

    ∑︁
yn=   hk·xn+k
     k

The exact form depends on the support region specified when creating the correlation object and the bias option.

Parameters
Example

vsip_corr1d_f *corr; 
vsip_vview_f *h, *x, *y; 
vsip_length m = 1024;  // Input signal length 
vsip_length n = 64;    // Reference signal length 
vsip_length y_len;     // Output length 
 
// Create correlation object for full correlation 
corr = vsip_corr1d_create_f(m, n, VSIP_SUPPORT_FULL, 100, VSIP_ALG_TIME); 
if (corr == NULL) { 
    fprintf(stderr, "Error: Could not create correlation object\n"); 
    return; 
} 
 
// Determine output length based on support region 
vsip_corr1d_attr_f attr; 
vsip_corr1d_getattr_f(corr, &attr); 
y_len = (attr.support == VSIP_SUPPORT_FULL) ? m + n - 1 : 
       (attr.support == VSIP_SUPPORT_SAME) ? m : 
       abs(m - n) + 1; 
 
// Create vectors 
h = vsip_vcreate_f(n, VSIP_MEM_NONE);      // Reference signal 
x = vsip_vcreate_f(m, VSIP_MEM_NONE);      // Input signal 
y = vsip_vcreate_f(y_len, VSIP_MEM_NONE);  // Output correlation 
 
// Initialize reference and input signals 
// vsip_vramp_f(0.0f, 1.0f, h);  // Example: linear ramp for reference 
// vsip_vramp_f(0.0f, 0.5f, x);  // Example: linear ramp for input 
 
// Compute correlation without bias 
vsip_correlate1d_f(corr, VSIP_NOBIAS, h, x, y); 
 
// Compute correlation with bias (normalized) 
vsip_correlate1d_f(corr, VSIP_BIASED, h, x, y); 
 
// Clean up 
vsip_corr1d_destroy_f(corr); 
vsip_valldestroy_f(h); 
vsip_valldestroy_f(x); 
vsip_valldestroy_f(y);
Notes