| 40 | } |
| 41 | |
| 42 | void mexFunction |
| 43 | ( |
| 44 | int nargout, |
| 45 | mxArray *pargout [ ], |
| 46 | int nargin, |
| 47 | const mxArray *pargin [ ] |
| 48 | ) |
| 49 | { |
| 50 | |
| 51 | bool malloc_debug = GB_mx_get_global (true) ; |
| 52 | GrB_Matrix A = NULL, C = NULL ; |
| 53 | GrB_Descriptor desc = NULL ; |
| 54 | void *blob = NULL ; |
| 55 | GrB_Index blob_size = 0 ; |
| 56 | |
| 57 | // check inputs |
| 58 | if (nargout > 1 || nargin < 1 || nargin > 3) |
| 59 | { |
| 60 | mexErrMsgTxt ("Usage: " USAGE) ; |
| 61 | } |
| 62 | |
| 63 | #define GET_DEEP_COPY ; |
| 64 | #define FREE_DEEP_COPY ; |
| 65 | |
| 66 | // get A (shallow copy) |
| 67 | A = GB_mx_mxArray_to_Matrix (pargin [0], "A input", false, true) ; |
| 68 | if (A == NULL) |
| 69 | { |
| 70 | FREE_ALL ; |
| 71 | mexErrMsgTxt ("A failed") ; |
| 72 | } |
| 73 | |
| 74 | // get the type of A |
| 75 | GrB_Type atype ; |
| 76 | GxB_Matrix_type (&atype, A) ; |
| 77 | |
| 78 | // get method |
| 79 | int GET_SCALAR (1, int, method, 0) ; |
| 80 | bool use_GrB_serialize = (method < -1) ; |
| 81 | if (use_GrB_serialize) |
| 82 | { |
| 83 | method = 0 ; |
| 84 | } |
| 85 | if (method != 0) |
| 86 | { |
| 87 | GrB_Descriptor_new (&desc) ; |
| 88 | GxB_Desc_set (desc, GxB_COMPRESSION, method) ; |
| 89 | } |
| 90 | |
| 91 | // serialize A into the blob and then deserialize into C |
| 92 | if (use_GrB_serialize) |
| 93 | { |
| 94 | // if (GB_VECTOR_OK (A)) |
| 95 | // { |
| 96 | // // test the vector methods |
| 97 | // METHOD (GrB_Vector_serializeSize (&blob_size, (GrB_Vector) A)) ; |
| 98 | // blob = mxMalloc (blob_size) ; |
| 99 | // METHOD (GrB_Vector_serialize (blob, &blob_size, (GrB_Vector) A)) ; |
nothing calls this directly
no test coverage detected