| 34 | #include "GB_serialize.h" |
| 35 | |
| 36 | GrB_Info GxB_Matrix_serialize // serialize a GrB_Matrix to a blob |
| 37 | ( |
| 38 | // output: |
| 39 | void **blob_handle, // the blob, allocated on output |
| 40 | GrB_Index *blob_size_handle, // size of the blob on output |
| 41 | // input: |
| 42 | GrB_Matrix A, // matrix to serialize |
| 43 | const GrB_Descriptor desc // descriptor to select compression method |
| 44 | // and to control # of threads used |
| 45 | ) |
| 46 | { |
| 47 | |
| 48 | //-------------------------------------------------------------------------- |
| 49 | // check inputs |
| 50 | //-------------------------------------------------------------------------- |
| 51 | |
| 52 | GB_WHERE1 ("GxB_Matrix_serialize (&blob, &blob_size, A, desc)") ; |
| 53 | GB_BURBLE_START ("GxB_Matrix_serialize") ; |
| 54 | GB_RETURN_IF_NULL (blob_handle) ; |
| 55 | GB_RETURN_IF_NULL (blob_size_handle) ; |
| 56 | GB_RETURN_IF_NULL_OR_FAULTY (A) ; |
| 57 | GB_GET_DESCRIPTOR (info, desc, xx1, xx2, xx3, xx4, xx5, xx6, xx7) ; |
| 58 | |
| 59 | // get the compression method from the descriptor |
| 60 | int method = (desc == NULL) ? GxB_DEFAULT : desc->compression ; |
| 61 | |
| 62 | //-------------------------------------------------------------------------- |
| 63 | // serialize the matrix |
| 64 | //-------------------------------------------------------------------------- |
| 65 | |
| 66 | (*blob_handle) = NULL ; |
| 67 | size_t blob_size = 0 ; |
| 68 | info = GB_serialize ((GB_void **) blob_handle, &blob_size, A, method, |
| 69 | Context) ; |
| 70 | (*blob_size_handle) = (GrB_Index) blob_size ; |
| 71 | GB_BURBLE_END ; |
| 72 | #pragma omp flush |
| 73 | return (info) ; |
| 74 | } |
| 75 |
no test coverage detected