vsip_mview_f* vsip_mputrowstride_f(const vsip_mview_f *v, vsip_stride stride); vsip_cmview_f* vsip_cmputrowstride_f(const vsip_cmview_f *v, vsip_stride stride);
This function modifies the row stride of an existing matrix view. The row stride determines how elements are laid out in memory along the rows of the matrix (how many elements to skip when moving from one row to the next within a column).
const vsip_dmview_p* v: Pointer to the matrix view to be modified.
vsip_stride stride: The new row stride value.
Returns a pointer to the modified matrix view.
vsip_mview_f *matrix; vsip_stride original_stride, new_stride; // Create a matrix matrix = vsip_mcreate_f(100, 100, VSIP_ROW, VSIP_MEM_NONE); original_stride = vsip_mgetrowstride_f(matrix); printf("Original row stride: %ld\n", original_stride); // Typically 1 // Change to stride of 2 (every other element in rows) if (vsip_mputrowstride_f(matrix, 2) == NULL) { // Handle error } printf("New row stride: %ld\n", vsip_mgetcolstride_f(matrix)); // Output: 2
The new stride must be compatible with the matrix dimensions and block size:
(row length - 1) * new stride + offset must be
block size
Changing the row stride affects how elements are accessed when moving along columns.