vsip_mview_f* vsip_mimagview_f(const vsip_cmview_f* cmatrix);
This function creates a real matrix view that represents the imaginary parts of a complex matrix. The resulting matrix view shares the same underlying data block as the complex matrix but provides access to only the imaginary components of each complex element.
For a complex matrix
with elements
, the imaginary view matrix
will have elements
.
const vsip_cmview_p* cmatrix: Pointer to the source complex matrix view.
On success, returns a pointer to the newly created real matrix view representing the imaginary parts.
On error, returns NULL.
vsip_cmview_f *complex_matrix; vsip_mview_f *imag_matrix; vsip_length i, j; // Create a 3x3 complex matrix complex_matrix = vsip_cmcreate_f(3, 3, VSIP_ROW, VSIP_MEM_NONE); // Fill with complex values for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { vsip_cmput_f(complex_matrix, i, j, VSIP_CMPLX_F(i*3+j+1, (i*3+j+1)*0.1f)); } } // Create an imaginary view of the complex matrix imag_matrix = vsip_mimagview_f(complex_matrix); if (imag_matrix == NULL) { // Handle error }
The imaginary matrix view shares the same underlying data block as the source complex matrix.
Modifications to the imaginary matrix view will affect the imaginary parts of the complex matrix and vice versa.
The imaginary matrix view has the same dimensions as the source complex matrix.
This operation is efficient as it doesn’t copy any data, only creates a new view.