| 128 | //------------------------------------------------------------------------------ |
| 129 | |
| 130 | GrB_Info GB_builder // build a matrix from tuples |
| 131 | ( |
| 132 | GrB_Matrix T, // matrix to build, static or dynamic header |
| 133 | const GrB_Type ttype, // type of output matrix T |
| 134 | const int64_t vlen, // length of each vector of T |
| 135 | const int64_t vdim, // number of vectors in T |
| 136 | const bool is_csc, // true if T is CSC, false if CSR |
| 137 | int64_t **I_work_handle, // for (i,k) or (j,i,k) tuples |
| 138 | size_t *I_work_size_handle, |
| 139 | int64_t **J_work_handle, // for (j,i,k) tuples |
| 140 | size_t *J_work_size_handle, |
| 141 | GB_void **S_work_handle, // array of values of tuples, size ijslen, |
| 142 | // or size 1 if S is iso |
| 143 | size_t *S_work_size_handle, |
| 144 | bool known_sorted, // true if tuples known to be sorted |
| 145 | bool known_no_duplicates, // true if tuples known to not have dupl |
| 146 | int64_t ijslen, // size of I_work and J_work arrays |
| 147 | const bool is_matrix, // true if T a GrB_Matrix, false if vector |
| 148 | const int64_t *restrict I_input,// original indices, size nvals |
| 149 | const int64_t *restrict J_input,// original indices, size nvals |
| 150 | const GB_void *restrict S_input,// array of values of tuples, size nvals, |
| 151 | // or size 1 if S_input or S_work are iso |
| 152 | const bool S_iso, // true if S_input or S_work are iso |
| 153 | const int64_t nvals, // number of tuples, and size of K_work |
| 154 | const GrB_BinaryOp dup, // binary function to assemble duplicates, |
| 155 | // if NULL use the SECOND operator to |
| 156 | // keep the most recent duplicate. |
| 157 | const GrB_Type stype, // the type of S_work or S_input |
| 158 | bool do_burble, // if true, then burble is allowed |
| 159 | GB_Context Context |
| 160 | ) |
| 161 | { |
| 162 | |
| 163 | //-------------------------------------------------------------------------- |
| 164 | // check inputs |
| 165 | //-------------------------------------------------------------------------- |
| 166 | |
| 167 | ASSERT (T != NULL) ; // T is a static or dynamic header on input |
| 168 | ASSERT (nvals >= 0) ; |
| 169 | ASSERT_TYPE_OK (ttype, "ttype for builder", GB0) ; |
| 170 | ASSERT_BINARYOP_OK_OR_NULL (dup, "dup for builder", GB0) ; |
| 171 | ASSERT (I_work_handle != NULL) ; |
| 172 | ASSERT (J_work_handle != NULL) ; |
| 173 | ASSERT (S_work_handle != NULL) ; |
| 174 | ASSERT (!GB_OP_IS_POSITIONAL (dup)) ; |
| 175 | ASSERT (I_work_size_handle != NULL) ; |
| 176 | ASSERT (J_work_size_handle != NULL) ; |
| 177 | ASSERT (S_work_size_handle != NULL) ; |
| 178 | |
| 179 | //-------------------------------------------------------------------------- |
| 180 | // get Sx |
| 181 | //-------------------------------------------------------------------------- |
| 182 | |
| 183 | GB_void *restrict S_work = (*S_work_handle) ; |
| 184 | const GB_void *restrict Sx = (S_work == NULL) ? S_input : S_work ; |
| 185 | ASSERT (GB_IMPLIES (nvals > 0, Sx != NULL)) ; |
| 186 | ASSERT (GB_IMPLIES (S_iso, ttype == stype)) ; |
| 187 | ASSERT (GB_IMPLIES (S_iso, dup == NULL)) ; |
no test coverage detected