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.

4.6.13 vsip_vcminmg_p - Element-wise Minimum of Complex Vector Magnitudes

void vsip_vcminmg_f(const vsip_cvview_f *a, const vsip_cvview_f *b, const vsip_vview_f *r);
Description

This function computes the element-wise minimum of the magnitudes of corresponding elements from two complex vectors, storing the results in a real output vector. The operation performs element-wise comparison of complex magnitudes:

ri= min(|ai|,| bi| )

for all i from 0 to n-1, where n is the length of the vectors, and |ai| and |bi| are the magnitudes of the complex numbers.

Parameters
Example

vsip_cvview_f *reference, *noisy_signal; 
vsip_vview_f *min_magnitudes; 
vsip_length n = 1024; 
 
// Create vectors 
reference = vsip_cvcreate_f(n, VSIP_MEM_NONE); 
noisy_signal = vsip_cvcreate_f(n, VSIP_MEM_NONE); 
min_magnitudes = vsip_vcreate_f(n, VSIP_MEM_NONE); 
 
// Initialize complex vectors with signal data 
for (vsip_length i = 0; i < n; i++) { 
    // Create a reference signal and a noisy version 
    float angle = 2 * M_PI * i / n; 
    vsip_cscalar_f ref_val = VSIP_CMPLX_F(5.0f * cos(angle), 5.0f * sin(angle)); 
 
    // Add some noise to create the noisy signal 
    float noise_real = 0.5f * ((float)rand()/RAND_MAX - 0.5f); 
    float noise_imag = 0.5f * ((float)rand()/RAND_MAX - 0.5f); 
    vsip_cscalar_f noisy_val = VSIP_CMPLX_F(ref_val.r + noise_real, ref_val.i + noise_imag); 
 
    vsip_cvput_f(reference, i, ref_val); 
    vsip_cvput_f(noisy_signal, i, noisy_val); 
} 
 
// Compute element-wise minimum of magnitudes 
vsip_vcminmg_f(reference, noisy_signal, min_magnitudes); 
 
// The min_magnitudes vector now contains the minimum magnitude at each position 
// from the two input complex signals, which can be useful for noise analysis 
 
// Clean up 
vsip_cvalldestroy_f(reference); 
vsip_cvalldestroy_f(noisy_signal); 
vsip_valldestroy_f(min_magnitudes);
Notes