| 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 X_iterator = NULL, Y_iterator ; |
| 50 | |
| 51 | // check inputs |
| 52 | if (nargout > 1 || nargin < 2 || nargin > 3) |
| 53 | { |
| 54 | mexErrMsgTxt ("Usage: " USAGE) ; |
| 55 | } |
| 56 | |
| 57 | // get X (shallow copy) |
| 58 | X = GB_mx_mxArray_to_Vector (pargin [0], "X input", false, true) ; |
| 59 | if (X == NULL) |
| 60 | { |
| 61 | FREE_ALL ; |
| 62 | mexErrMsgTxt ("X failed") ; |
| 63 | } |
| 64 | |
| 65 | // get Y (shallow copy) |
| 66 | Y = GB_mx_mxArray_to_Vector (pargin [1], "Y input", false, true) ; |
| 67 | if (Y == NULL) |
| 68 | { |
| 69 | FREE_ALL ; |
| 70 | mexErrMsgTxt ("Y failed") ; |
| 71 | } |
| 72 | |
| 73 | // get kind: |
| 74 | // 0: merge, using macros |
| 75 | // 1: iterate through x and lookup y, using macros |
| 76 | // 2: merge, using functions |
| 77 | // 3: iterate through x and lookup y, using functions |
| 78 | int GET_SCALAR (2, int, kind, 0) ; |
| 79 | bool use_macros = (kind <= 1) ; |
| 80 | kind = kind % 2 ; |
| 81 | |
| 82 | GrB_Index n, ny ; |
| 83 | OK (GrB_Vector_size (&n, X)) ; |
| 84 | OK (GrB_Vector_size (&ny, Y)) ; |
| 85 | |
| 86 | GB_Global_print_one_based_set (0) ; |
| 87 | |
| 88 | if (n != ny) |
| 89 | { |
| 90 | FREE_ALL ; |
| 91 | mexErrMsgTxt ("X and Y must have the same size") ; |
| 92 | } |
| 93 |
nothing calls this directly
no test coverage detected