void vsip_mbind_f(const vsip_block_f* block, vsip_offset offset, vsip_stride col_stride, vsip_stride col_length, vsip_length row_length, vsip_length row_length); void vsip_cmbind_f(const vsip_cblock_f* block, vsip_offset offset, vsip_stride col_stride, vsip_stride col_length, vsip_length row_length, vsip_length row_length);
This function binds a matrix view to a section of a data block, allowing access to the block’s data through the matrix view interface. The binding specifies the location of the matrix within the block, the strides between elements, and the dimensions of the matrix.
The matrix view becomes a "window" into the block, with the specified dimensions and strides. This allows for efficient access to submatrices or non-contiguous sections of a larger data block without copying data.
const vsip_dblock_p* block: Pointer to the block of data to bind to.
vsip_offset offset: The offset (in elements) from the start of the block to the first element of the matrix (0,0 position).
vsip_stride col_stride: The stride (in elements) between consecutive columns of the matrix.
vsip_length col_length: The number of columns in the matrix view.
vsip_stride row_stride: The stride (in elements) between consecutive rows of the matrix.
vsip_length row_length: The number of rows in the matrix view.
vsip_block_f *block; vsip_mview_f matrix_view; vsip_scalar_f *data; vsip_length block_size = 1000; // Allocate a block of data block = vsip_blockcreate_f(block_size, VSIP_MEM_NONE); // Populate block with data here // Bind a 10x10 matrix view to the block starting at offset 0 // with contiguous memory layout (col_stride = 1, row_stride = 10) matrix_view = vsip_mbind_f(block, 0, 1, 10, 10, 10);
The block must be large enough to contain the matrix view with the specified strides.
The strides determine how elements are accessed in memory:
col_stride is the step size between columns (typically 1 for contiguous columns)
row_stride is the step size between rows (typically equal to the number of columns for contiguous rows)
Non-unit strides allow for accessing non-contiguous sections of the block.
The matrix view does not own the data; the block must remain valid as long as the view is in use.
This function is useful for creating views of submatrices or for implementing specialized matrix layouts.