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.13 vsip_dmgetattrib_p - Get Matrix Attributes

typedef struct { 
    vsip_length row_length;   /* Number of rows */ 
    vsip_length col_length;   /* Number of columns */ 
    vsip_offset offset;       /* Offset into the block */ 
    vsip_stride row_stride;   /* Stride between rows */ 
    vsip_stride col_stride;   /* Stride between columns */ 
    vsip_block_f* block;      /* Pointer to the data block */ 
} vsip_mattr_f; 
/* same for the other dataypes with the respective vsip_dblock_p */ 
 
void vsip_mgetattrib_f(const vsip_mview_f* v, vsip_mattr_f* attr); 
void vsip_cmgetattrib_f(const vsip_cmview_f* v, vsip_cmattr_f* attr);
Description

This function retrieves all attributes of a matrix view and stores them in a vsip_dmattr_p structure. The attribute structure contains complete information about the matrix view’s dimensions, memory layout, and binding to its data block.

Parameters
Example

vsip_mview_f *matrix; 
vsip_mattr_f attr; 
 
// Create a matrix 
matrix = vsip_mcreate_f(100, 100, VSIP_ROW, VSIP_MEM_NONE); 
 
// Get all matrix attributes 
vsip_mgetattrib_f(matrix, &attr); 
 
printf("Matrix attributes:\n"); 
printf("  Dimensions: %lu x %lu\n", attr.row_length, attr.col_length); 
printf("  Memory offset: %ld\n", attr.offset); 
printf("  Row stride: %ld\n", attr.row_stride); 
printf("  Column stride: %ld\n", attr.col_stride); 
printf("  Block pointer: %p\n", (void*)attr.block); 
 
// Create a submatrix view and examine its attributes 
vsip_mview_f *submatrix = vsip_msubview_f(matrix, 10, 10, 50, 50); 
vsip_mgetattrib_f(submatrix, &attr); 
 
printf("\nSubmatrix attributes:\n"); 
printf("  Dimensions: %lu x %lu\n", attr.row_length, attr.col_length); 
printf("  Memory offset: %ld\n", attr.offset); 
 
// Create a transposed view and examine its attributes 
vsip_mview_f *transposed = vsip_mtransview_f(matrix); 
vsip_mgetattrib_f(transposed, &attr); 
 
printf("\nTransposed matrix attributes:\n"); 
printf("  Dimensions: %lu x %lu\n", attr.row_length, attr.col_length); 
printf("  Row stride: %ld\n", attr.row_stride); 
printf("  Column stride: %ld\n", attr.col_stride);
Notes