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.

1.4.8 vsip_dmrowview_p - Create a Row Vector View of a Matrix

vsip_vview_f* vsip_mrowview_f(const vsip_mview_f* matrix, vsip_index row_index); 
vsip_cvview_f* vsip_cmrowview_f(const vsip_cmview_f* matrix, vsip_index row_index);
Description

This function creates a vector view that represents a single row of a matrix. The resulting vector view shares the same underlying data block as the matrix but provides access to only the specified row. This operation is efficient as it doesn’t copy any data, but rather creates a new view that references the row data.

The created vector view has a length equal to the number of columns in the source matrix. The vector view maintains the same data type as the matrix elements.

Parameters
Return Value
Example

vsip_mview_f *matrix; 
vsip_vview_f *row_vector; 
vsip_length i, j; 
 
// Create a 5x10 matrix 
matrix = vsip_mcreate_f(5, 10, VSIP_ROW, VSIP_MEM_NONE); 
 
// Fill the matrix with some values 
for (i = 0; i < 5; i++) { 
    for (j = 0; j < 10; j++) { 
        vsip_mput_f(matrix, i, j, i * 10 + j + 1); 
    } 
} 
 
// Get a vector view of the 3rd row (index 2) 
row_vector = vsip_mrowview_f(matrix, 2); 
 
if (row_vector == NULL) { 
    // Handle error 
} 
 
// Now row_vector represents the 3rd row of the matrix 
// and has length equal to the number of columns (10)
Notes