| 15 | #define GB_FREE_ALL GB_Matrix_free (A) ; |
| 16 | |
| 17 | GrB_Info GB_import // import/pack a matrix in any format |
| 18 | ( |
| 19 | bool packing, // pack if true, create and import false |
| 20 | |
| 21 | GrB_Matrix *A, // handle of matrix to create, or pack |
| 22 | GrB_Type type, // type of matrix to create |
| 23 | GrB_Index vlen, // vector length |
| 24 | GrB_Index vdim, // vector dimension |
| 25 | bool is_sparse_vector, // true if A is a sparse GrB_Vector |
| 26 | |
| 27 | // the 5 arrays: |
| 28 | GrB_Index **Ap, // pointers, for sparse and hypersparse formats. |
| 29 | GrB_Index Ap_size, // size of Ap in bytes |
| 30 | |
| 31 | GrB_Index **Ah, // vector indices for hypersparse matrices |
| 32 | GrB_Index Ah_size, // size of Ah in bytes |
| 33 | |
| 34 | int8_t **Ab, // bitmap, for bitmap format only. |
| 35 | GrB_Index Ab_size, // size of Ab in bytes |
| 36 | |
| 37 | GrB_Index **Ai, // indices for hyper and sparse formats |
| 38 | GrB_Index Ai_size, // size of Ai in bytes |
| 39 | |
| 40 | void **Ax, // values |
| 41 | GrB_Index Ax_size, // size of Ax in bytes |
| 42 | |
| 43 | // additional information for specific formats: |
| 44 | GrB_Index nvals, // # of entries for bitmap format, or for a vector |
| 45 | // in CSC format. |
| 46 | bool jumbled, // if true, sparse/hypersparse may be jumbled. |
| 47 | GrB_Index nvec, // size of Ah for hypersparse format. |
| 48 | |
| 49 | // information for all formats: |
| 50 | int sparsity, // hypersparse, sparse, bitmap, or full |
| 51 | bool is_csc, // if true then matrix is by-column, else by-row |
| 52 | bool iso, // if true then A is iso and only one entry is provided |
| 53 | // in Ax, regardless of nvals(A). |
| 54 | // fast vs secure import: |
| 55 | bool fast_import, // if true: trust the data, if false: check it |
| 56 | |
| 57 | bool add_to_memtable, // if true: add to debug memtable |
| 58 | GB_Context Context |
| 59 | ) |
| 60 | { |
| 61 | |
| 62 | //-------------------------------------------------------------------------- |
| 63 | // check inputs |
| 64 | //-------------------------------------------------------------------------- |
| 65 | |
| 66 | GB_RETURN_IF_NULL (A) ; |
| 67 | |
| 68 | if (!packing) |
| 69 | { |
| 70 | (*A) = NULL ; |
| 71 | } |
| 72 | |
| 73 | GB_RETURN_IF_NULL_OR_FAULTY (type) ; |
| 74 | if (vlen > GB_NMAX || vdim > GB_NMAX || nvals > GB_NMAX || nvec > GB_NMAX |
no test coverage detected