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

1.4.1 vsip_dmcreate_p - Create a Matrix View

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);
Description

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.

Parameters
Return Value
Example

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 
}
Notes