| 18 | #define GB_FREE_ALL ; |
| 19 | |
| 20 | GrB_Info GB_conform_hyper // conform a matrix to sparse/hypersparse |
| 21 | ( |
| 22 | GrB_Matrix A, // matrix to conform |
| 23 | GB_Context Context |
| 24 | ) |
| 25 | { |
| 26 | |
| 27 | //-------------------------------------------------------------------------- |
| 28 | // check inputs |
| 29 | //-------------------------------------------------------------------------- |
| 30 | |
| 31 | GrB_Info info = GrB_SUCCESS ; |
| 32 | ASSERT_MATRIX_OK (A, "A to conform_hyper", GB0) ; |
| 33 | ASSERT (!GB_IS_FULL (A)) ; |
| 34 | ASSERT (!GB_IS_BITMAP (A)) ; |
| 35 | ASSERT (GB_ZOMBIES_OK (A)) ; |
| 36 | ASSERT (GB_JUMBLED_OK (A)) ; |
| 37 | ASSERT (GB_PENDING_OK (A)) ; |
| 38 | |
| 39 | //-------------------------------------------------------------------------- |
| 40 | // convert to sparse or hypersparse |
| 41 | //-------------------------------------------------------------------------- |
| 42 | |
| 43 | if (A->nvec_nonempty < 0) |
| 44 | { |
| 45 | // A->nvec_nonempty is used to select sparse vs hypersparse |
| 46 | A->nvec_nonempty = GB_nvec_nonempty (A, Context) ; |
| 47 | } |
| 48 | |
| 49 | if (A->h == NULL && GB_convert_sparse_to_hyper_test (A->hyper_switch, |
| 50 | A->nvec_nonempty, A->vdim)) // A->nvec_nonempty used here |
| 51 | { |
| 52 | // A is sparse but should be converted to hypersparse |
| 53 | GB_OK (GB_convert_sparse_to_hyper (A, Context)) ; |
| 54 | } |
| 55 | else if (A->h != NULL && GB_convert_hyper_to_sparse_test (A->hyper_switch, |
| 56 | A->nvec_nonempty, A->vdim)) // A->nvec_nonempty used here |
| 57 | { |
| 58 | // A is hypersparse but should be converted to sparse |
| 59 | GB_OK (GB_convert_hyper_to_sparse (A, true, Context)) ; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | // leave the matrix as-is |
| 64 | ; |
| 65 | } |
| 66 | |
| 67 | //-------------------------------------------------------------------------- |
| 68 | // return result |
| 69 | //-------------------------------------------------------------------------- |
| 70 | |
| 71 | ASSERT_MATRIX_OK (A, "A conform_hyper result", GB0) ; |
| 72 | return (GrB_SUCCESS) ; |
| 73 | } |
| 74 |
no test coverage detected