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

Function GB_cast_array

deps/GraphBLAS/Source/GB_cast_array.c:20–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#endif
19
20GB_PUBLIC
21void GB_cast_array // typecast an array
22(
23 GB_void *Cx, // output array
24 const GB_Type_code code1, // type code for Cx
25 GB_void *Ax, // input array
26 const GB_Type_code code2, // type code for Ax
27 const int8_t *restrict Ab, // bitmap for Ax
28 const int64_t anz, // number of entries in Cx and Ax
29 const int nthreads // number of threads to use
30)
31{
32
33 //--------------------------------------------------------------------------
34 // check inputs
35 //--------------------------------------------------------------------------
36
37 if (anz == 0 || Cx == Ax)
38 {
39 // if anz is zero: no work to do, and the Ax and Cx pointer may be NULL
40 // as well. If Cx and Ax are aliased, then no copy is needed.
41 return ;
42 }
43
44 ASSERT (Cx != NULL) ;
45 ASSERT (Ax != NULL) ;
46 ASSERT (anz > 0) ;
47 ASSERT (GB_code_compatible (code1, code2)) ;
48 ASSERT (code1 != code2) ;
49 ASSERT (code1 != GB_UDT_code) ;
50
51 //--------------------------------------------------------------------------
52 // typecast the array
53 //--------------------------------------------------------------------------
54
55 #ifndef GBCUDA_DEV
56
57 //----------------------------------------------------------------------
58 // define the worker for the switch factory
59 //----------------------------------------------------------------------
60
61 #define GB_unop_apply(zname,xname) \
62 GB (_unop_apply__identity ## zname ## xname)
63
64 #define GB_WORKER(ignore1,zname,ztype,xname,xtype) \
65 { \
66 GrB_Info info = GB_unop_apply (zname,xname) \
67 ((ztype *) Cx, (xtype *) Ax, Ab, anz, nthreads) ; \
68 if (info == GrB_SUCCESS) return ; \
69 } \
70 break ;
71
72 //----------------------------------------------------------------------
73 // launch the switch factory
74 //----------------------------------------------------------------------
75
76 #define GB_EXCLUDE_SAME_TYPES
77 #include "GB_2type_factory.c"

Callers 5

GB_cast_matrixFunction · 0.85
GB_extractTuplesFunction · 0.85
mexFunctionFunction · 0.85
GB_mx_mxArray_to_MatrixFunction · 0.85
GB_mx_object_to_mxArrayFunction · 0.85

Calls 3

GB_code_compatibleFunction · 0.85
GB_code_sizeFunction · 0.85
GB_cast_factoryFunction · 0.85

Tested by

no test coverage detected