void vsip_vcmaxmg_f(const vsip_cvview_f *a, const vsip_cvview_f *b, const vsip_vview_f *r);
This function computes the element-wise maximum 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:

for all
from 0 to
, where
is the length of the vectors, and
and
are the magnitudes of the complex
numbers.
const vsip_cvview_p* a: First input complex vector.
const vsip_cvview_p* b: Second input complex vector.
const vsip_vview_p* r: Output real vector that will store the maximum magnitude results.
vsip_cvview_f *signal1, *signal2; vsip_vview_f *max_magnitudes; vsip_length n = 1024; // Create vectors signal1 = vsip_cvcreate_f(n, VSIP_MEM_NONE); signal2 = vsip_cvcreate_f(n, VSIP_MEM_NONE); max_magnitudes = vsip_vcreate_f(n, VSIP_MEM_NONE); // Initialize complex vectors with some signal data for (vsip_length i = 0; i < n; i++) { // Create two different complex signals float angle1 = 2 * M_PI * i / n; float angle2 = 2 * M_PI * i / n + M_PI/4; vsip_cscalar_f val1 = VSIP_CMPLX_F(5.0f * cos(angle1), 5.0f * sin(angle1)); vsip_cscalar_f val2 = VSIP_CMPLX_F(3.0f * cos(angle2), 3.0f * sin(angle2)); vsip_cvput_f(signal1, i, val1); vsip_cvput_f(signal2, i, val2); } // Compute element-wise maximum of magnitudes vsip_vcmaxmg_f(signal1, signal2, max_magnitudes); // The max_magnitudes vector now contains the maximum magnitude at each position // from the two input complex signals // Clean up vsip_cvalldestroy_f(signal1); vsip_cvalldestroy_f(signal2); vsip_valldestroy_f(max_magnitudes);
All three vectors must have the same length.