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

Function GB_subref

deps/GraphBLAS/Source/GB_subref.c:91–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89#include "GB_subref.h"
90
91GB_PUBLIC
92GrB_Info GB_subref // C = A(I,J): either symbolic or numeric
93(
94 // output
95 GrB_Matrix C, // output matrix, static header
96 // input, not modified
97 bool C_iso, // if true, return C as iso, regardless of A
98 const bool C_is_csc, // requested format of C
99 const GrB_Matrix A,
100 const GrB_Index *I, // index list for C = A(I,J), or GrB_ALL, etc.
101 const int64_t ni, // length of I, or special
102 const GrB_Index *J, // index list for C = A(I,J), or GrB_ALL, etc.
103 const int64_t nj, // length of J, or special
104 const bool symbolic, // if true, construct C as symbolic
105 GB_Context Context
106)
107{
108
109 //--------------------------------------------------------------------------
110 // check inputs
111 //--------------------------------------------------------------------------
112
113 GrB_Info info ;
114 ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ;
115 ASSERT_MATRIX_OK (A, "A for C=A(I,J) subref", GB0) ;
116 ASSERT (GB_ZOMBIES_OK (A)) ;
117 ASSERT (GB_JUMBLED_OK (A)) ; // A is sorted, below, if jumbled on input
118 ASSERT (GB_PENDING_OK (A)) ;
119
120 //--------------------------------------------------------------------------
121 // check if C is iso and get its iso value
122 //--------------------------------------------------------------------------
123
124 GrB_Type ctype = (symbolic) ? GrB_INT64 : A->type ;
125 size_t csize = ctype->size ;
126 GB_void cscalar [GB_VLA(csize)] ;
127 memset (cscalar, 0, csize) ;
128 if (symbolic)
129 {
130 // symbolic extraction never results in an iso matrix
131 C_iso = false ;
132 }
133 else
134 {
135 // determine if C is iso and get the iso scalar
136 if (A->iso)
137 {
138 memcpy (cscalar, A->x, csize) ;
139 C_iso = true ;
140 }
141 }
142
143 if (C_iso)
144 {
145 GBURBLE ("(iso subref) ") ;
146 }
147
148 //--------------------------------------------------------------------------

Callers 7

GB_extractFunction · 0.85
GB_AxB_dot2Function · 0.85
GB_assign_prepFunction · 0.85
GB_subassign_symbolicFunction · 0.85
GB_assignFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85

Calls 6

GB_bitmap_subrefFunction · 0.85
GB_subref_phase0Function · 0.85
GB_subref_sliceFunction · 0.85
GB_subref_phase2Function · 0.85
GB_subref_phase3Function · 0.85
GB_nnzFunction · 0.50

Tested by

no test coverage detected