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

Function GB_add

deps/GraphBLAS/Source/GB_add.c:53–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51#define GB_FREE_ALL ;
52
53GrB_Info GB_add // C=A+B, C<M>=A+B, or C<!M>=A+B
54(
55 GrB_Matrix C, // output matrix, static header
56 const GrB_Type ctype, // type of output matrix C
57 const bool C_is_csc, // format of output matrix C
58 const GrB_Matrix M, // optional mask for C, unused if NULL
59 const bool Mask_struct, // if true, use the only structure of M
60 const bool Mask_comp, // if true, use !M
61 bool *mask_applied, // if true, the mask was applied
62 const GrB_Matrix A, // input A matrix
63 const GrB_Matrix B, // input B matrix
64 const bool is_eWiseUnion, // if true, eWiseUnion, else eWiseAdd
65 const GrB_Scalar alpha, // alpha and beta ignored for eWiseAdd,
66 const GrB_Scalar beta, // nonempty scalars for GxB_eWiseUnion
67 const GrB_BinaryOp op, // op to perform C = op (A,B)
68 GB_Context Context
69)
70{
71
72 //--------------------------------------------------------------------------
73 // check inputs
74 //--------------------------------------------------------------------------
75
76 GrB_Info info ;
77
78 ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ;
79
80 ASSERT (mask_applied != NULL) ;
81 (*mask_applied) = false ;
82
83 ASSERT_MATRIX_OK (A, "A for add", GB0) ;
84 ASSERT_MATRIX_OK (B, "B for add", GB0) ;
85 ASSERT_BINARYOP_OK_OR_NULL (op, "op for add", GB0) ;
86 ASSERT_MATRIX_OK_OR_NULL (M, "M for add", GB0) ;
87 ASSERT (A->vdim == B->vdim && A->vlen == B->vlen) ;
88 ASSERT (GB_IMPLIES (M != NULL, A->vdim == M->vdim && A->vlen == M->vlen)) ;
89
90 //--------------------------------------------------------------------------
91 // delete any lingering zombies and assemble any pending tuples
92 //--------------------------------------------------------------------------
93
94 // TODO: some cases can allow M, A, and/or B to be jumbled
95 GB_MATRIX_WAIT (M) ; // cannot be jumbled
96 GB_MATRIX_WAIT (A) ; // cannot be jumbled
97 GB_MATRIX_WAIT (B) ; // cannot be jumbled
98
99 //--------------------------------------------------------------------------
100 // determine the sparsity of C
101 //--------------------------------------------------------------------------
102
103 bool apply_mask ;
104 int C_sparsity = GB_add_sparsity (&apply_mask, M, Mask_comp, A, B) ;
105
106 //--------------------------------------------------------------------------
107 // initializations
108 //--------------------------------------------------------------------------
109
110 int64_t Cnvec, Cnvec_nonempty ;

Callers 6

GrB_InfoFunction · 0.85
GB_emultFunction · 0.85
GB_accum_maskFunction · 0.85
GB_ewiseFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85

Calls 8

GB_add_sparsityFunction · 0.85
GB_add_phase0Function · 0.85
GB_sparsity_charFunction · 0.85
GB_sparsity_char_matrixFunction · 0.85
GB_ewise_sliceFunction · 0.85
GB_add_phase1Function · 0.85
GB_nthreadsFunction · 0.85
GB_add_phase2Function · 0.85

Tested by

no test coverage detected