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

Function mexFunction

deps/GraphBLAS/Test/GB_mex_about9.c:53–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51#define FREE_DEEP_COPY ;
52
53void mexFunction
54(
55 int nargout,
56 mxArray *pargout [ ],
57 int nargin,
58 const mxArray *pargin [ ]
59)
60{
61
62 GrB_Info info ;
63
64 //--------------------------------------------------------------------------
65 // startup GraphBLAS
66 //--------------------------------------------------------------------------
67
68 bool malloc_debug = GB_mx_get_global (true) ;
69
70 //--------------------------------------------------------------------------
71 // user-defined type of 256 bytes
72 //--------------------------------------------------------------------------
73
74 GrB_Type BigType ;
75 METHOD (GxB_Type_new (&BigType, sizeof (bigtype), "bigtype",
76 "typedef struct { double stuff [32] ; } bigtype")) ;
77 OK (GxB_Type_fprint (BigType, "(256-byte big type)", GxB_COMPLETE,
78 stdout)) ;
79 OK (GrB_Type_free (&BigType)) ;
80
81 //--------------------------------------------------------------------------
82 // user-defined operators
83 //--------------------------------------------------------------------------
84
85 GrB_UnaryOp op1 = NULL ;
86 METHOD (GxB_UnaryOp_new (&op1, &f1, GrB_FP64, GrB_FP64, "f1", F1)) ;
87 OK (GxB_UnaryOp_fprint (op1, "f1", GxB_COMPLETE, stdout)) ;
88 OK (GrB_UnaryOp_free (&op1)) ;
89
90 GrB_BinaryOp op2 = NULL ;
91 METHOD (GxB_BinaryOp_new (&op2, &f2, GrB_FP64, GrB_FP64, GrB_FP64,
92 "f2", F2)) ;
93 OK (GxB_BinaryOp_fprint (op2, "f2", GxB_COMPLETE, stdout)) ;
94 OK (GrB_BinaryOp_free (&op2)) ;
95
96 GrB_IndexUnaryOp opi = NULL ;
97 METHOD (GxB_IndexUnaryOp_new (&opi, &i1, GrB_FP64, GrB_FP64, GrB_FP64,
98 "i1", I1)) ;
99 OK (GxB_IndexUnaryOp_fprint (opi, "i1", GxB_COMPLETE, stdout)) ;
100 OK (GrB_IndexUnaryOp_free (&opi)) ;
101
102 //--------------------------------------------------------------------------
103 // reduce an empty matrix to a scalar using the ANY monoid
104 //--------------------------------------------------------------------------
105
106 GrB_Matrix A ;
107 OK (GrB_Matrix_new (&A, GrB_FP32, 10, 10)) ;
108 OK (GxB_Matrix_fprint (A, "empty matrix", GxB_COMPLETE, stdout)) ;
109 float x = 42 ;
110 OK (GrB_Matrix_reduce_FP32 (&x, NULL, GxB_ANY_FP32_MONOID, A, NULL)) ;

Callers

nothing calls this directly

Calls 15

GB_mx_get_globalFunction · 0.85
GxB_Type_newFunction · 0.85
GxB_Type_fprintFunction · 0.85
GrB_Type_freeFunction · 0.85
GxB_UnaryOp_newFunction · 0.85
GxB_UnaryOp_fprintFunction · 0.85
GrB_UnaryOp_freeFunction · 0.85
GxB_BinaryOp_newFunction · 0.85
GxB_BinaryOp_fprintFunction · 0.85
GrB_BinaryOp_freeFunction · 0.85
GxB_IndexUnaryOp_newFunction · 0.85
GxB_IndexUnaryOp_fprintFunction · 0.85

Tested by

no test coverage detected