1 //------------------------------------------------------------------------------ 2 // GB_matlab_helper.h: helper functions for MATLAB interface 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 // These functions are only used by the MATLAB interface for 11 // SuiteSparse:GraphBLAS. 12 13 #ifndef GB_MATLAB_HELPER_H 14 #define GB_MATLAB_HELPER_H 15 16 #include "GB.h" 17 18 GB_PUBLIC 19 void GB_matlab_helper1 // convert zero-based indices to one-based 20 ( 21 double *restrict I_double, // output array 22 const GrB_Index *restrict I, // input array 23 int64_t nvals // size of input and output arrays 24 ) ; 25 26 GB_PUBLIC 27 void GB_matlab_helper1i // convert zero-based indices to one-based 28 ( 29 int64_t *restrict I, // input/output array 30 int64_t nvals // size of input/output array 31 ) ; 32 33 GB_PUBLIC 34 bool GB_matlab_helper3 // return true if OK, false on error 35 ( 36 int64_t *restrict List, // size len, output array 37 const double *restrict List_double, // size len, input array 38 int64_t len, 39 int64_t *List_max // also compute the max entry in the list 40 ) ; 41 42 GB_PUBLIC 43 bool GB_matlab_helper3i // return true if OK, false on error 44 ( 45 int64_t *restrict List, // size len, output array 46 const int64_t *restrict List_int64, // size len, input array 47 int64_t len, 48 int64_t *List_max // also compute the max entry in the list 49 ) ; 50 51 GB_PUBLIC 52 bool GB_matlab_helper4 // return true if OK, false on error 53 ( 54 const GrB_Index *restrict I, // array of size len 55 const int64_t len, 56 GrB_Index *List_max // find max (I) + 1 57 ) ; 58 59 GB_PUBLIC 60 void GB_matlab_helper5 // construct pattern of S 61 ( 62 GrB_Index *restrict Si, // array of size anz 63 GrB_Index *restrict Sj, // array of size anz 64 const GrB_Index *restrict Mi, // array of size mnz, M->i 65 const GrB_Index *restrict Mj, // array of size mnz 66 const int64_t mvlen, // M->vlen 67 GrB_Index *restrict Ai, // array of size anz, A->i 68 const int64_t avlen, // M->vlen 69 const GrB_Index anz 70 ) ; 71 72 GB_PUBLIC 73 void GB_matlab_helper6 // set Gbool to all true 74 ( 75 bool *restrict Gbool, // array of size gnvals 76 const GrB_Index gnvals 77 ) ; 78 79 GB_PUBLIC 80 void GB_matlab_helper7 // Kx = uint64 (0:mnz-1) 81 ( 82 uint64_t *restrict Kx, // array of size mnz 83 const GrB_Index mnz 84 ) ; 85 86 GB_PUBLIC 87 void GB_matlab_helper8 88 ( 89 GB_void *C, // output array of size nvals * s 90 GB_void *A, // input scalar of size s 91 GrB_Index nvals, // size of C 92 size_t s // size of each scalar 93 ) ; 94 95 GB_PUBLIC 96 bool GB_matlab_helper9 // true if successful, false if out of memory 97 ( 98 GrB_Matrix A, // input matrix 99 int64_t **degree, // degree of each vector, size nvec 100 size_t *degree_size, // size of degree, in bytes 101 GrB_Index **list, // list of non-empty vectors 102 size_t *list_size, // size of degree, in bytes 103 GrB_Index *nvec // # of non-empty vectors 104 ) ; 105 106 GB_PUBLIC 107 double GB_matlab_helper10 // norm (x-y,p) 108 ( 109 GB_void *x_arg, // float or double, depending on type parameter 110 GB_void *y_arg, // same type as x, treat as zero if NULL 111 GrB_Type type, // GrB_FP32 or GrB_FP64 112 int64_t p, // 0, 1, 2, INT64_MIN, or INT64_MAX 113 GrB_Index n 114 ) ; 115 116 #endif 117 118