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

Function GB_extractTuples

deps/GraphBLAS/Source/GB_extractTuples.c:29–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29GrB_Info GB_extractTuples // extract all tuples from a matrix
30(
31 GrB_Index *I_out, // array for returning row indices of tuples
32 GrB_Index *J_out, // array for returning col indices of tuples
33 void *X, // array for returning values of tuples
34 GrB_Index *p_nvals, // I,J,X size on input; # tuples on output
35 const GB_Type_code xcode, // type of array X
36 const GrB_Matrix A, // matrix to extract tuples from
37 GB_Context Context
38)
39{
40
41 //--------------------------------------------------------------------------
42 // check inputs
43 //--------------------------------------------------------------------------
44
45 GrB_Info info ;
46 GB_void *restrict X_bitmap = NULL ; size_t X_bitmap_size = 0 ;
47 int64_t *restrict Ap = NULL ; size_t Ap_size = 0 ;
48
49 ASSERT_MATRIX_OK (A, "A to extract", GB0) ;
50 ASSERT (p_nvals != NULL) ;
51
52 // delete any lingering zombies and assemble any pending tuples;
53 // allow A to remain jumbled
54 GB_MATRIX_WAIT_IF_PENDING_OR_ZOMBIES (A) ;
55
56 GB_BURBLE_DENSE (A, "(A %s) ") ;
57 ASSERT (xcode <= GB_UDT_code) ;
58 const GB_Type_code acode = A->type->code ;
59 const size_t asize = A->type->size ;
60
61 // xcode and A must be compatible
62 if (!GB_code_compatible (xcode, acode))
63 {
64 return (GrB_DOMAIN_MISMATCH) ;
65 }
66
67 const int64_t anz = GB_nnz (A) ;
68 if (anz == 0)
69 {
70 // no work to do
71 (*p_nvals) = 0 ;
72 return (GrB_SUCCESS) ;
73 }
74
75 int64_t nvals = *p_nvals ; // size of I,J,X on input
76 if (nvals < anz && (I_out != NULL || J_out != NULL || X != NULL))
77 {
78 // output arrays are not big enough
79 return (GrB_INSUFFICIENT_SPACE) ;
80 }
81
82 //-------------------------------------------------------------------------
83 // determine the number of threads to use
84 //-------------------------------------------------------------------------
85
86 GB_GET_NTHREADS_MAX (nthreads_max, chunk, Context) ;

Callers 2

GB_concat_hyperFunction · 0.85
GB_export_workerFunction · 0.85

Calls 10

GB_code_compatibleFunction · 0.85
GB_nthreadsFunction · 0.85
GB_convert_bitmap_workerFunction · 0.85
GB_cast_arrayFunction · 0.85
GB_memcpyFunction · 0.85
GB_extract_vector_listFunction · 0.85
GB_code_sizeFunction · 0.85
GB_cast_scalarFunction · 0.85
GB_iso_expandFunction · 0.85
GB_nnzFunction · 0.50

Tested by

no test coverage detected