1 //------------------------------------------------------------------------------
2 // GB_export.h: definitions for import/export
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 #ifndef GB_EXPORT_H
11 #define GB_EXPORT_H
12 #include "GB_transpose.h"
13 
14 GrB_Info GB_import      // import a matrix in any format
15 (
16     GrB_Matrix *A,      // handle of matrix to create
17     GrB_Type type,      // type of matrix to create
18     GrB_Index vlen,     // vector length
19     GrB_Index vdim,     // vector dimension
20     bool is_sparse_vector,      // true if A is a sparse GrB_Vector
21 
22     // the 5 arrays:
23     GrB_Index **Ap,     // pointers, for sparse and hypersparse formats.
24     GrB_Index Ap_size,  // size of Ap in bytes
25 
26     GrB_Index **Ah,     // vector indices for hypersparse matrices
27     GrB_Index Ah_size,  // size of Ah in bytes
28 
29     int8_t **Ab,        // bitmap, for bitmap format only.
30     GrB_Index Ab_size,  // size of Ab in bytes
31 
32     GrB_Index **Ai,     // indices for hyper and sparse formats
33     GrB_Index Ai_size,  // size of Ai in bytes
34 
35     void **Ax,          // values
36     GrB_Index Ax_size,  // size of Ax in bytes
37 
38     // additional information for specific formats:
39     GrB_Index nvals,    // # of entries for bitmap format, or for a vector
40                         // in CSC format.
41     bool jumbled,       // if true, sparse/hypersparse may be jumbled.
42     GrB_Index nvec,     // size of Ah for hypersparse format.
43 
44     // information for all formats:
45     int sparsity,       // hypersparse, sparse, bitmap, or full
46     bool is_csc,        // if true then matrix is by-column, else by-row
47     bool is_uniform,    // if true then A has uniform values and only one
48                         // entry is provided in Ax, regardless of nvals(A).
49                         // TODO::: uniform valued matrices not yet supported
50     GB_Context Context
51 ) ;
52 
53 GrB_Info GB_export      // export a matrix in any format
54 (
55     GrB_Matrix *A,      // handle of matrix to export and free
56     GrB_Type *type,     // type of matrix to export
57     GrB_Index *vlen,    // vector length
58     GrB_Index *vdim,    // vector dimension
59     bool is_sparse_vector,      // true if A is a sparse GrB_Vector
60 
61     // the 5 arrays:
62     GrB_Index **Ap,     // pointers
63     GrB_Index *Ap_size, // size of Ap in bytes
64 
65     GrB_Index **Ah,     // vector indices
66     GrB_Index *Ah_size, // size of Ah in bytes
67 
68     int8_t **Ab,        // bitmap
69     GrB_Index *Ab_size, // size of Ab in bytes
70 
71     GrB_Index **Ai,     // indices
72     GrB_Index *Ai_size, // size of Ai in bytes
73 
74     void **Ax,          // values
75     GrB_Index *Ax_size, // size of Ax in bytes
76 
77     // additional information for specific formats:
78     GrB_Index *nvals,   // # of entries for bitmap format.
79     bool *jumbled,      // if true, sparse/hypersparse may be jumbled.
80     GrB_Index *nvec,    // size of Ah for hypersparse format.
81 
82     // information for all formats:
83     int *sparsity,      // hypersparse, sparse, bitmap, or full
84     bool *is_csc,       // if true then matrix is by-column, else by-row
85     bool *is_uniform,   // if true then A has uniform values and only one
86                         // entry is returned in Ax, regardless of nvals(A).
87                         // TODO::: uniform valued matrices not yet supported
88     GB_Context Context
89 ) ;
90 
91 #endif
92 
93