| 34 | } |
| 35 | |
| 36 | void mexFunction |
| 37 | ( |
| 38 | int nargout, |
| 39 | mxArray *pargout [ ], |
| 40 | int nargin, |
| 41 | const mxArray *pargin [ ] |
| 42 | ) |
| 43 | { |
| 44 | |
| 45 | GrB_Info info ; |
| 46 | bool malloc_debug = GB_mx_get_global (true) ; |
| 47 | GrB_Vector Y = NULL, X = NULL ; |
| 48 | GrB_Matrix A = NULL ; |
| 49 | GxB_Iterator iterator = NULL ; |
| 50 | |
| 51 | // check inputs |
| 52 | if (nargout > 1 || nargin < 2 || nargin > 3) |
| 53 | { |
| 54 | mexErrMsgTxt ("Usage: " USAGE) ; |
| 55 | } |
| 56 | |
| 57 | // get A (shallow copy) |
| 58 | A = GB_mx_mxArray_to_Matrix (pargin [0], "A input", false, true) ; |
| 59 | if (A == NULL) |
| 60 | { |
| 61 | FREE_ALL ; |
| 62 | mexErrMsgTxt ("A failed") ; |
| 63 | } |
| 64 | GrB_Index nrows, ncols ; |
| 65 | OK (GrB_Matrix_nrows (&nrows, A)) ; |
| 66 | OK (GrB_Matrix_ncols (&ncols, A)) ; |
| 67 | GB_Global_print_one_based_set (0) ; |
| 68 | |
| 69 | // get X (shallow copy) |
| 70 | X = GB_mx_mxArray_to_Vector (pargin [1], "X input", false, true) ; |
| 71 | if (X == NULL) |
| 72 | { |
| 73 | FREE_ALL ; |
| 74 | mexErrMsgTxt ("X failed") ; |
| 75 | } |
| 76 | // GxB_print (X, 3) ; |
| 77 | |
| 78 | GrB_Index n ; |
| 79 | OK (GrB_Vector_size (&n, X)) ; |
| 80 | if (n != ncols) |
| 81 | { |
| 82 | FREE_ALL ; |
| 83 | mexErrMsgTxt ("X has the wrong size") ; |
| 84 | } |
| 85 | |
| 86 | GrB_Type type = A->type ; |
| 87 | if (type != X->type) |
| 88 | { |
| 89 | FREE_ALL ; |
| 90 | mexErrMsgTxt ("A and X must have the same type") ; |
| 91 | } |
| 92 | |
| 93 | // get kind |
nothing calls this directly
no test coverage detected