typedef enum _vsip_memory_hint { VSIP_MEM_NONE = 0, VSIP_MEM_RDONLY = 1, VSIP_MEM_CONST = 2, VSIP_MEM_SHARED = 3, VSIP_MEM_SHARED_RDONLY = 4, VSIP_MEM_SHARED_CONST = 5 } vsip_memory_hint; typedef enum { VSIP_ROW = 0, VSIP_COL = 1 } vsip_major; vsip_mview_f* vsip_mcreate_f(vsip_length row_length, vsip_length col_length, vsip_major major, vsip_mem_hint hint); vsip_cmview_f* vsip_cmcreate_f(vsip_length row_length, vsip_length col_length, vsip_major major, vsip_mem_hint hint);
This function creates a new matrix view with the specified dimensions. The function allocates both a data block and a matrix view, and binds them together.
Whether the matrix is stored in row- or column major order can be selected using the major argument.
vsip_length row_length: Number of rows in the matrix.
vsip_length col_length: Number of columns in the matrix.
vsip_major major: Whether the matrix is supposed to be row- or column major.
vsip_mem_hint hint: Memory allocation hint that can be used to optimize memory access.
VSIP_MEM_NONE - No memory hint
VSIP_MEM_RDONLY - The memory is to be used read-only
VSIP_MEM_CONST - The memory will hold constants
VSIP_MEM_SHARED - The memory will be shared
VSIP_MEM_SHARED_RDONLY - The memory will be shared and is read-only
VSIP_MEM_SHARED_CONST - The memory will be shared and will hold constants
On success, returns a pointer to the newly created matrix view.
On error, returns NULL.
vsip_mview_f *matrix; vsip_length rows = 100; vsip_length cols = 100; // Create a 100x100 matrix initialized to 0.0 matrix = vsip_mcreate_f(rows, cols, VSIP_ROW, VSIP_MEM_NONE); if (matrix == NULL) { // Handle error }
The created matrix has contiguous memory layout with unit strides in both dimensions.
This function is equivalent to calling vsip_blockcreate_f, then vsip_mbind_f, and finally filling the matrix with the specified value.