MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / import_test

Function import_test

deps/GraphBLAS/Demo/Source/import_test.c:65–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63#include "../Source/GB.h"
64
65GB_PUBLIC
66GrB_Info import_test (GrB_Matrix *C_handle, int format, bool dump)
67{
68
69 GrB_Type type ;
70 GrB_Index nrows, ncols, nvec ;
71 GrB_Index *Ap = NULL, *Ah = NULL, *Ai = NULL, *Aj = NULL ;
72 GrB_Index Ap_size = 0 ;
73 GrB_Index Ah_size = 0 ;
74 GrB_Index Ab_size = 0 ;
75 GrB_Index Ai_size = 0 ;
76 GrB_Index Aj_size = 0 ;
77 GrB_Index Ax_size = 0 ;
78 bool iso = false ;
79 bool jumbled ;
80
81 void *Ax = NULL ;
82
83 bool *Ax_bool = NULL ;
84 int8_t *Ax_int8 = NULL ;
85 int16_t *Ax_int16 = NULL ;
86 int32_t *Ax_int32 = NULL ;
87 int64_t *Ax_int64 = NULL ;
88 uint8_t *Ax_uint8 = NULL ;
89 uint16_t *Ax_uint16 = NULL ;
90 uint32_t *Ax_uint32 = NULL ;
91 uint64_t *Ax_uint64 = NULL ;
92 float *Ax_fp32 = NULL ;
93 double *Ax_fp64 = NULL ;
94
95 GrB_Info info = GrB_SUCCESS ;
96
97 printf ("\n========================= import_test: format %d\n", format) ;
98 OK (GxB_Matrix_fprint (*(C_handle), "C to export",
99 dump ? GxB_COMPLETE : GxB_SHORT, stdout)) ;
100
101 switch (format)
102 {
103
104 //----------------------------------------------------------------------
105 case 0 :
106 //----------------------------------------------------------------------
107
108 OK (GxB_Matrix_export_CSR (C_handle, &type, &nrows, &ncols,
109 &Ap, &Aj, &Ax, &Ap_size, &Aj_size, &Ax_size, &iso,
110 &jumbled, NULL)) ;
111
112 // the export destroys the matrix (*C_handle), returning its
113 // contents in Ap, Aj, and Ax.
114 CHECK (*C_handle == NULL, GrB_INVALID_VALUE) ;
115
116 if (dump)
117 {
118 printf ("export standard CSR: %g-by-%g, Ax_size %g:\n",
119 (double) nrows, (double) ncols, (double) Ax_size) ;
120 OK (GxB_Type_fprint (type, "type", GxB_COMPLETE, stdout)) ;
121 GETVAL ;
122 printf ("Ap %p Aj %p Ax %p\n", (void *) Ap, (void *) Aj, Ax) ;

Callers 1

mainFunction · 0.85

Calls 10

GxB_Matrix_fprintFunction · 0.85
GxB_Matrix_export_CSRFunction · 0.85
GxB_Type_fprintFunction · 0.85
GxB_Matrix_import_CSRFunction · 0.85
GxB_Matrix_export_CSCFunction · 0.85
GxB_Matrix_import_CSCFunction · 0.85

Tested by

no test coverage detected