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.7 vsip_dmtransview_p - Create a Transposed Matrix View

vsip_mview_f* vsip_mtransview_f(const vsip_mview_f* matrix); 
vsip_cmview_f* vsip_cmtransview_f(const vsip_cmview_f* matrix);
Description

This function creates a new matrix view that represents the transpose of the input matrix. The transposed view shares the same underlying data block as the original matrix but presents it with rows and columns swapped. This operation is efficient as it doesn’t copy any data, but rather creates a new view with transposed dimensions and strides.

For an m ×n input matrix, the transposed view will be an n× m matrix where the element at position (i,j) in the transposed view corresponds to the element at position (j,i) in the original matrix.

Parameters
Return Value
Example

vsip_mview_f *original_matrix; 
vsip_mview_f *transposed_matrix; 
vsip_length i, j; 
 
// Create a 4x3 matrix 
original_matrix = vsip_mcreate_f(4, 3, VSIP_ROW, VSIP_MEM_NONE); 
 
// Fill the matrix with some values 
for (i = 0; i < 4; i++) { 
    for (j = 0; j < 3; j++) { 
        vsip_mput_f(original_matrix, i, j, i * 3 + j + 1); 
    } 
} 
 
// Create a transposed view (3x4) 
transposed_matrix = vsip_mtransview_f(original_matrix); 
 
if (transposed_matrix == NULL) { 
    // Handle error 
} 
 
// Now transposed_matrix is a 3x4 view of the original 4x3 matrix data 
// Accessing transposed_matrix[0][1] is equivalent to original_matrix[1][0]
Notes