vsip_mview_f* vsip_mrealview_f(const vsip_cmview_f* cmatrix);
This function creates a real matrix view that represents the real 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 real components of each complex element.
For a complex matrix
with elements
, the real 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 real parts.
On error, returns NULL.
vsip_cmview_f *complex_matrix; vsip_mview_f *real_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 a real view of the complex matrix real_matrix = vsip_mrealview_f(complex_matrix); if (real_matrix == NULL) { // Handle error }
The real matrix view shares the same underlying data block as the source complex matrix.
Modifications to the real matrix view will affect the real parts of the complex matrix and vice versa.
The real 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.