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

4.6.9 vsip_vminmg_p - Element-wise Minimum of Magnitudes

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

This function computes the element-wise minimum of the magnitudes (absolute values) of corresponding elements from two vectors. The operation performs element-wise comparison of magnitudes:

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

for all i from 0 to n-1, where n is the length of the vectors.

Parameters
Example

vsip_vview_f *signal1, *signal2, *result; 
vsip_length n = 1024; 
 
// Create vectors 
signal1 = vsip_vcreate_f(n, VSIP_MEM_NONE); 
signal2 = vsip_vcreate_f(n, VSIP_MEM_NONE); 
result = vsip_vcreate_f(n, VSIP_MEM_NONE); 
 
// Initialize vectors with some signal data 
// For example, two different signal measurements 
for (vsip_length i = 0; i < n; i++) { 
    vsip_vput_f(signal1, i, 5.0f * sin(2 * M_PI * i / n)); 
    vsip_vput_f(signal2, i, 3.0f * cos(2 * M_PI * i / n) + 2.0f); 
} 
 
// Compute element-wise minimum of magnitudes 
vsip_vminmg_f(signal1, signal2, result); 
 
// The result vector now contains the maximum magnitude at each position 
// from the two input signals 
 
// Clean up 
vsip_valldestroy_f(signal1); 
vsip_valldestroy_f(signal2); 
vsip_valldestroy_f(result);
Notes