void vsip_vrect_f(const vsip_vview_f *a, const vsip_vview_f *b, const vsip_cvview_f *r);
This function converts pairs of real vectors representing Cartesian coordinates (real and imaginary parts) into a complex vector.
The operation performs element-wise conversion:

for all
from 0 to
, where
is the length of the vectors,
is the real part,
is the imaginary part, and
is the
resulting complex number.
const vsip_vview_p* a: Input vector containing real parts.
const vsip_vview_p* b: Input vector containing imaginary parts.
const vsip_cvview_p* r: Output complex vector that will store the results.
vsip_vview_f *real_parts, *imag_parts; vsip_cvview_f *complex_numbers; vsip_length n = 10; // Create vectors real_parts = vsip_vcreate_f(n, VSIP_MEM_NONE); imag_parts = vsip_vcreate_f(n, VSIP_MEM_NONE); complex_numbers = vsip_cvcreate_f(n, VSIP_MEM_NONE); // Initialize real and imaginary parts // For example, create a complex signal for (vsip_length i = 0; i < n; i++) { vsip_vput_f(real_parts, i, cos(2 * M_PI * i / n)); // Real parts vsip_vput_f(imag_parts, i, sin(2 * M_PI * i / n)); // Imaginary parts } // Convert to complex numbers vsip_vrect_f(real_parts, imag_parts, complex_numbers); // The complex_numbers vector now contains the complex representation // of your signal, which can be used in further complex operations // Print some results printf("Complex numbers (first 3 elements):\n"); for (vsip_length i = 0; i < 3; i++) { vsip_cscalar_f val = vsip_cvget_f(complex_numbers, i); printf("(%.4f, %.4f) ", val.r, val.i); } printf("\n"); // Clean up vsip_valldestroy_f(real_parts); vsip_valldestroy_f(imag_parts); vsip_cvalldestroy_f(complex_numbers);
All three vectors must have the same length.
This operation is the inverse of vsip_vpolar_p which converts from polar to Cartesian coordinates.