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.8 vsip_vmaxmg_p - Element-wise Maximum of Magnitudes

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

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

ri= max(|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 maximum of magnitudes 
vsip_vmaxmg_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