Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

1.4.14 vsip_dmputattrib_p - Set 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 */ 
 
vsip_mview_f* vsip_mputattrib_f(vsip_mview_f* v, const vsip_mattr_f* attr); 
vsip_cmview_f* vsip_cmputattrib_f(vsip_cmview_f* v, const vsip_cmattr_f* attr);
Description

This function modifies the attributes of an existing matrix view according to the parameters specified in a vsip_dmattr_p structure. It allows you to change the view’s dimensions, memory layout, and binding to its data block in a single operation.

Parameters
Return Value
Example

vsip_mview_f *matrix; 
vsip_mattr_f attr; 
vsip_block_f *new_block; 
 
// Create a matrix 
matrix = vsip_mcreate_f(100, 100, VSIP_ROW, VSIP_MEM_NONE); 
 
// Get current attributes 
vsip_mgetattrib_f(matrix, &attr); 
printf("Original dimensions: %lu x %lu\n", attr.row_length, attr.col_length); 
 
// Modify the view to show only a submatrix 
attr.row_length = 50;      // Show only first 50 rows 
attr.col_length = 50;      // Show only first 50 columns 
attr.offset = 0;           // Start from beginning of block 
// Keep the same strides and block 
 
if (vsip_mputattrib_f(matrix, &attr) == NULL) { 
    // Handle error 
}
Notes