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

Function mexFunction

deps/GraphBLAS/Test/GB_mex_Matrix_subref.c:21–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21void mexFunction
22(
23 int nargout,
24 mxArray *pargout [ ],
25 int nargin,
26 const mxArray *pargin [ ]
27)
28{
29 struct GB_Matrix_opaque C_header ;
30 GrB_Matrix C = GB_clear_static_header (&C_header) ;
31
32 bool malloc_debug = GB_mx_get_global (true) ;
33 GrB_Matrix A = NULL ;
34 GrB_Index *I = NULL, ni = 0, I_range [3] ;
35 GrB_Index *J = NULL, nj = 0, J_range [3] ;
36 bool ignore ;
37
38 // check inputs
39 GB_CONTEXT (USAGE) ;
40 if (nargout > 1 || nargin != 3)
41 {
42 mexErrMsgTxt ("Usage: " USAGE) ;
43 }
44
45 #define GET_DEEP_COPY ;
46 #define FREE_DEEP_COPY ;
47
48 // get A (shallow copy)
49 A = GB_mx_mxArray_to_Matrix (pargin [0], "A", false, true) ;
50 if (A == NULL)
51 {
52 FREE_ALL ;
53 mexErrMsgTxt ("A failed") ;
54 }
55
56 // get I
57 if (!GB_mx_mxArray_to_indices (&I, pargin [1], &ni, I_range, &ignore))
58 {
59 FREE_ALL ;
60 mexErrMsgTxt ("I failed") ;
61 }
62
63 // get J
64 if (!GB_mx_mxArray_to_indices (&J, pargin [2], &nj, J_range, &ignore))
65 {
66 FREE_ALL ;
67 mexErrMsgTxt ("J failed") ;
68 }
69
70 // C = A(I,J), numeric not symbolic
71 METHOD (GB_subref (C, C->iso, true, A, I, ni, J, nj, false, Context)) ;
72
73 // return C
74 pargout [0] = GB_mx_Matrix_to_mxArray (&C, "C subref result", false) ;
75
76 FREE_ALL ;
77}
78

Callers

nothing calls this directly

Calls 6

GB_mx_get_globalFunction · 0.85
GB_mx_mxArray_to_MatrixFunction · 0.85
GB_mx_mxArray_to_indicesFunction · 0.85
GB_subrefFunction · 0.85
GB_mx_Matrix_to_mxArrayFunction · 0.85
GB_clear_static_headerFunction · 0.50

Tested by

no test coverage detected