| 31 | #include "GB_serialize.h" |
| 32 | |
| 33 | GrB_Info GrB_Matrix_serialize // serialize a GrB_Matrix to a blob |
| 34 | ( |
| 35 | // output: |
| 36 | void *blob, // the blob, already allocated in input |
| 37 | // input/output: |
| 38 | GrB_Index *blob_size_handle, // size of the blob on input. On output, |
| 39 | // the # of bytes used in the blob. |
| 40 | // input: |
| 41 | GrB_Matrix A // matrix to serialize |
| 42 | ) |
| 43 | { |
| 44 | |
| 45 | //-------------------------------------------------------------------------- |
| 46 | // check inputs |
| 47 | //-------------------------------------------------------------------------- |
| 48 | |
| 49 | GB_WHERE1 ("GrB_Matrix_serialize (blob, &blob_size, A)") ; |
| 50 | GB_BURBLE_START ("GrB_Matrix_serialize") ; |
| 51 | GB_RETURN_IF_NULL (blob) ; |
| 52 | GB_RETURN_IF_NULL (blob_size_handle) ; |
| 53 | GB_RETURN_IF_NULL_OR_FAULTY (A) ; |
| 54 | |
| 55 | // no descriptor, so assume the default method |
| 56 | int method = GxB_DEFAULT ; |
| 57 | |
| 58 | // Context will hold the default # of threads, which can be controlled |
| 59 | // by GxB_Global_Option_set. |
| 60 | |
| 61 | //-------------------------------------------------------------------------- |
| 62 | // serialize the matrix into the preallocated blob |
| 63 | //-------------------------------------------------------------------------- |
| 64 | |
| 65 | size_t blob_size = (size_t) (*blob_size_handle) ; |
| 66 | GrB_Info info = GB_serialize ((GB_void **) &blob, &blob_size, A, method, |
| 67 | Context) ; |
| 68 | if (info == GrB_SUCCESS) |
| 69 | { |
| 70 | (*blob_size_handle) = (GrB_Index) blob_size ; |
| 71 | } |
| 72 | GB_BURBLE_END ; |
| 73 | #pragma omp flush |
| 74 | return (info) ; |
| 75 | } |
| 76 |
no test coverage detected