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

Function GB_binop_pattern

deps/GraphBLAS/Source/GB_binop_pattern.c:17–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include "GB_binop.h"
16
17void GB_binop_pattern
18(
19 // outputs:
20 bool *A_is_pattern, // true if A is pattern-only, because of the op
21 bool *B_is_pattern, // true if B is pattern-only, because of the op
22 // inputs:
23 const bool flipxy, // if true, z = op (b,a) will be computed
24 // if false, z = op (a,b) will be computed
25 const GB_Opcode opcode // opcode of binary op
26)
27{
28
29 //--------------------------------------------------------------------------
30 // determine A_is_pattern and B_is_pattern
31 //--------------------------------------------------------------------------
32
33 bool op_is_positional = GB_OPCODE_IS_POSITIONAL (opcode) ;
34 bool op_is_first = (opcode == GB_FIRST_binop_code) ;
35 bool op_is_second = (opcode == GB_SECOND_binop_code) ;
36 bool op_is_pair = (opcode == GB_PAIR_binop_code) ;
37
38 if (op_is_positional || op_is_pair)
39 {
40 // mult (x,y) does not depend on the values of x or y
41 (*A_is_pattern) = true ;
42 (*B_is_pattern) = true ;
43 }
44 else if (flipxy)
45 {
46 // z = mult (b,a) will be computed
47 (*A_is_pattern) = op_is_first ;
48 (*B_is_pattern) = op_is_second ;
49 }
50 else
51 {
52 // z = mult (a,b) will be computed
53 (*A_is_pattern) = op_is_second ;
54 (*B_is_pattern) = op_is_first ;
55 }
56}
57

Callers 7

GB_AxB_dot2Function · 0.85
GB_ewiseFunction · 0.85
GB_kronFunction · 0.85
GB_AxB_saxpy3Function · 0.85
GB_AxB_saxpy5Function · 0.85
GB_AxB_saxpy4Function · 0.85
GB_bitmap_AxB_saxpyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected