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

Function GB_compatible

deps/GraphBLAS/Source/GB_compatible.c:16–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include "GB.h"
15
16GrB_Info GB_compatible // SUCCESS if all is OK, *_MISMATCH otherwise
17(
18 const GrB_Type ctype, // the type of C (matrix or scalar)
19 const GrB_Matrix C, // the output matrix C; NULL if C is a scalar
20 const GrB_Matrix M, // optional mask, NULL if no mask
21 const bool Mask_struct, // true if M is structural
22 const GrB_BinaryOp accum, // C<M> = accum(C,T) is computed
23 const GrB_Type ttype, // type of T
24 GB_Context Context
25)
26{
27
28 //--------------------------------------------------------------------------
29 // check inputs
30 //--------------------------------------------------------------------------
31
32 // C may be aliased with M
33
34 GrB_Info info ;
35
36 //--------------------------------------------------------------------------
37 // check accum compatibility
38 //--------------------------------------------------------------------------
39
40 if (accum != NULL)
41 {
42 // Results T are accumlated via C<M>=accum(C,T)
43
44 // For entries in C and T, c=z=accum(c,t) is computed, so C must
45 // be compatible with both the ztype and xtype of accum, and T
46 // must be compatible with the ytype of accum.
47
48 // For entries in T but not C, c=t is assigned, so C and T must
49 // be compatible. This is the same as the condition below
50 // when accum is NULL.
51
52 GB_OK (GB_BinaryOp_compatible (accum, ctype, ctype, ttype,
53 GB_ignore_code, Context)) ;
54 }
55
56 //--------------------------------------------------------------------------
57 // check the types of C and T
58 //--------------------------------------------------------------------------
59
60 // C<M> = T, so C and T must be compatible.
61 // also C<M> = accum(C,T) for entries in T but not C
62 if (!GB_Type_compatible (ctype, ttype))
63 {
64 GB_ERROR (GrB_DOMAIN_MISMATCH,
65 "Result of computation of type [%s]\n"
66 "cannot be typecast to final output of type [%s]",
67 ttype->name, ctype->name) ;
68 }
69
70 //--------------------------------------------------------------------------
71 // check the mask
72 //--------------------------------------------------------------------------
73

Callers 9

GrB_transposeFunction · 0.85
GB_extractFunction · 0.85
GB_mxmFunction · 0.85
GB_ewiseFunction · 0.85
GB_kronFunction · 0.85
GB_reduce_to_scalarFunction · 0.85
GB_applyFunction · 0.85
GB_reduce_to_vectorFunction · 0.85
GB_selectFunction · 0.85

Calls 3

GB_BinaryOp_compatibleFunction · 0.85
GB_Type_compatibleFunction · 0.85
GB_Mask_compatibleFunction · 0.85

Tested by

no test coverage detected