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);
This function computes the one-dimensional correlation between an input signal
and a reference signal
using the pre-configured correlation object. The result is stored in the output vector
. The correlation operation
computes:

The exact form depends on the support region specified when creating the correlation object and the bias option.
const vsip_dcorr1d_p* cor: Pointer to the 1D correlation object created with vsip_dcorr1d_create_p .
vsip_bias bias: Bias option for the correlation:
VSIP_NOBIAS: No bias applied
VSIP_BIASED: Bias applied (normalization)
const vsip_dvview_p* h: Reference signal vector of length
.
const vsip_dvview_p* x: Input signal vector of length
.
const vsip_dvview_p* y: Output correlation vector. Its length depends on the support region specified in the correlation object.
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);
The input vectors
and
must have lengths matching those specified when the correlation object was created.
The output vector
must have the appropriate length based on the support region:
VSIP_SUPPORT_FULL:
VSIP_SUPPORT_SAME:
VSIP_SUPPORT_MIN: 
The bias option affects the normalization of the result:
VSIP_NOBIAS: No normalization applied
VSIP_BIASED: Result is normalized