vsip_scalar_f vsip_mget_f(const vsip_mview_f *v, vsip_index i, vsip_index j); vsip_cscalar_f vsip_cmget_f(const vsip_cmview_f *v, vsip_index i, vsip_index j);
This function retrieves the value of a specific element from a matrix view. The element is identified by its row and column indices (0-based).
const vsip_dmview_p* v: Pointer to the matrix view.
vsip_index i: Row index of the element to retrieve (0-based).
vsip_index j: Column index of the element to retrieve (0-based).
Returns the value of the matrix element at position
as a vsip_dscalar_p .
vsip_mview_f *matrix; vsip_scalar_f value; vsip_index i, j; // Create and initialize a matrix matrix = vsip_mcreate_f(5, 5, VSIP_ROW, VSIP_MEM_NONE); // Fill the matrix with some values for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) { vsip_mput_f(matrix, i, j, i * 5 + j + 1); } } // Retrieve specific elements value = vsip_mget_f(matrix, 0, 0); // Top-left corner printf("Element at (0,0): %f\n", value); value = vsip_mget_f(matrix, 2, 3); // Middle element printf("Element at (2,3): %f\n", value); value = vsip_mget_f(matrix, 4, 4); // Bottom-right corner printf("Element at (4,4): %f\n", value);
The function does not perform bounds checking and may return an error or undefined value if the indices are out of range.
For submatrix views, the indices are relative to the submatrix, not the parent matrix.