MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / mexFunction

Function mexFunction

deps/GraphBLAS/Test/GB_mex_resize.c:20–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void mexFunction
21(
22 int nargout,
23 mxArray *pargout [ ],
24 int nargin,
25 const mxArray *pargin [ ]
26)
27{
28
29 bool malloc_debug = GB_mx_get_global (true) ;
30 GrB_Matrix C = NULL ;
31
32 // check inputs
33 if (nargout > 1 || nargin < 1 || nargin > 3)
34 {
35 mexErrMsgTxt ("Usage: " USAGE) ;
36 }
37
38 #define GET_DEEP_COPY \
39 C = GB_mx_mxArray_to_Matrix (pargin [0], "C input", true, true) ;
40 #define FREE_DEEP_COPY GrB_Matrix_free_(&C) ;
41
42 GET_DEEP_COPY ;
43 if (C == NULL)
44 {
45 FREE_ALL ;
46 mexErrMsgTxt ("C failed") ;
47 }
48
49 // get vlen_new
50 int64_t GET_SCALAR (1, int64_t, vlen_new, C->vlen) ;
51
52 // get vdim_new
53 int64_t GET_SCALAR (2, int64_t, vdim_new, C->vdim) ;
54
55 // resize the matrix
56 if (vlen_new % 5 == 0)
57 {
58 // test the old GxB functions
59 if (GB_VECTOR_OK (C) && vdim_new == 1)
60 {
61 // resize C as a vector
62 METHOD (GxB_Vector_resize ((GrB_Vector) C, vlen_new)) ;
63 }
64 else
65 {
66 // resize C as a matrix
67 METHOD (GxB_Matrix_resize (C, vlen_new, vdim_new)) ;
68 }
69 }
70 else
71 {
72 // test the new GrB functions
73 if (GB_VECTOR_OK (C) && vdim_new == 1)
74 {
75 // resize C as a vector
76 METHOD (GrB_Vector_resize_((GrB_Vector) C, vlen_new)) ;
77 }

Callers

nothing calls this directly

Calls 4

GB_mx_get_globalFunction · 0.85
GxB_Vector_resizeFunction · 0.85
GxB_Matrix_resizeFunction · 0.85
GB_mx_Matrix_to_mxArrayFunction · 0.85

Tested by

no test coverage detected