| 76 | //------------------------------------------------------------------------------ |
| 77 | |
| 78 | GrB_Info import_export ( ) |
| 79 | { |
| 80 | |
| 81 | OK (GB_Matrix_check (C, "C to export", GB0, stdout)) ; |
| 82 | |
| 83 | //-------------------------------------------------------------------------- |
| 84 | // export/import a vector |
| 85 | //-------------------------------------------------------------------------- |
| 86 | |
| 87 | if (GB_VECTOR_OK (C)) |
| 88 | { |
| 89 | OK (GxB_Vector_export_CSC ((GrB_Vector *) (&C), &type, &nrows, |
| 90 | &Ai, (void **) &Ax, &Ai_size, &Ax_size, &iso, |
| 91 | &nvals, &jumbled, desc)) ; |
| 92 | |
| 93 | OK (GxB_Type_size (&asize, type)) ; |
| 94 | |
| 95 | if (dump) |
| 96 | { |
| 97 | printf ("export standard CSC vector: %llu-by-1, nvals %llu:\n", |
| 98 | nrows, nvals) ; |
| 99 | OK (GB_Type_check (type, "type", GxB_SUMMARY, stdout)) ; |
| 100 | GB_Type_code code = type->code ; |
| 101 | |
| 102 | for (int64_t p = 0 ; p < nvals ; p++) |
| 103 | { |
| 104 | printf (" row %llu value ", Ai [p]) ; |
| 105 | GB_code_check (code, Ax + (iso ? 0:p)*asize, 5, stdout) ; |
| 106 | printf ("\n") ; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | OK (GxB_Vector_import_CSC ((GrB_Vector *) (&C), type, nrows, |
| 111 | &Ai, (void **) &Ax, Ai_size, Ax_size, iso, nvals, jumbled, desc)) ; |
| 112 | |
| 113 | return (GrB_SUCCESS) ; |
| 114 | } |
| 115 | |
| 116 | //-------------------------------------------------------------------------- |
| 117 | // export/import a matrix |
| 118 | //-------------------------------------------------------------------------- |
| 119 | |
| 120 | switch (format) |
| 121 | { |
| 122 | |
| 123 | //---------------------------------------------------------------------- |
| 124 | case 0 : |
| 125 | //---------------------------------------------------------------------- |
| 126 | |
| 127 | OK (GxB_Matrix_export_CSR (&C, &type, &nrows, &ncols, |
| 128 | &Ap, &Aj, (void **) &Ax, &Ap_size, &Aj_size, &Ax_size, &iso, |
| 129 | &jumbled, desc)) ; |
| 130 | |
| 131 | OK (GxB_Type_size (&asize, type)) ; |
| 132 | nvec = nrows ; |
| 133 | |
| 134 | if (dump) |
| 135 | { |
no test coverage detected