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.9 vsip_dmcolview_p - Create a Column Vector View of a Matrix

vsip_vview_f* vsip_mcolview_f(const vsip_mview_f* matrix, vsip_index col_index); 
vsip_cvview_f* vsip_cmcolview_f(const vsip_cmview_f* matrix, vsip_index col_index);
Description

This function creates a vector view that represents a single column of a matrix. The resulting vector view shares the same underlying data block as the matrix but provides access to only the specified column. 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 rows 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 *col_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) 
col_vector = vsip_mcolview_f(matrix, 2); 
 
if (col_vector == NULL) { 
    // Handle error 
} 
 
// Now col_vector represents the 3rd row of the matrix 
// and has length equal to the number of rows (5)
Notes