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

Function mexFunction

deps/GraphBLAS/Test/GB_mex_clear.c:23–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void mexFunction
24(
25 int nargout,
26 mxArray *pargout [ ],
27 int nargin,
28 const mxArray *pargin [ ]
29)
30{
31
32 bool malloc_debug = GB_mx_get_global (true) ;
33 GrB_Matrix A = NULL, C = NULL ;
34
35 // check inputs
36 if (nargout > 1 || nargin < 1 || nargin > 3)
37 {
38 mexErrMsgTxt ("Usage: " USAGE) ;
39 }
40
41 #define GET_DEEP_COPY GrB_Matrix_dup (&C, A) ;
42 #define FREE_DEEP_COPY GrB_Matrix_free_(&C) ;
43
44 // get A (shallow copy)
45 A = GB_mx_mxArray_to_Matrix (pargin [0], "A input", false, true) ;
46 if (A == NULL)
47 {
48 FREE_ALL ;
49 mexErrMsgTxt ("A failed") ;
50 }
51
52 // output matrix has same type as input matrix
53 GrB_Type ctype = A->type ;
54
55 // copy A into C
56 GrB_Matrix_dup (&C, A) ;
57
58 // clear C
59 METHOD (GrB_Matrix_clear (C)) ;
60
61 // return C as a struct and free the GraphBLAS C
62 pargout [0] = GB_mx_Matrix_to_mxArray (&C, "C output", true) ;
63
64 FREE_ALL ;
65}
66

Callers

nothing calls this directly

Calls 5

GB_mx_get_globalFunction · 0.85
GB_mx_mxArray_to_MatrixFunction · 0.85
GrB_Matrix_dupFunction · 0.85
GrB_Matrix_clearFunction · 0.85
GB_mx_Matrix_to_mxArrayFunction · 0.85

Tested by

no test coverage detected