1 //------------------------------------------------------------------------------
2 // GB_ewise.h: definitions for GB_ewise
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 #ifndef GB_EWISE_H
11 #define GB_EWISE_H
12 #include "GB.h"
13 
14 GrB_Info GB_ewise                   // C<M> = accum (C, A+B) or A.*B
15 (
16     GrB_Matrix C,                   // input/output matrix for results
17     const bool C_replace,           // if true, clear C before writing to it
18     const GrB_Matrix M,             // optional mask for C, unused if NULL
19     const bool Mask_comp,           // if true, complement the mask M
20     const bool Mask_struct,         // if true, use the only structure of M
21     const GrB_BinaryOp accum,       // optional accum for Z=accum(C,T)
22     const GrB_BinaryOp op,          // defines '+' for C=A+B, or .* for A.*B
23     const GrB_Matrix A,             // input matrix
24     bool A_transpose,               // if true, use A' instead of A
25     const GrB_Matrix B,             // input matrix
26     bool B_transpose,               // if true, use B' instead of B
27     bool eWiseAdd,                  // if true, do set union (like A+B),
28                                     // otherwise do intersection (like A.*B)
29     GB_Context Context
30 ) ;
31 
32 void GB_ewise_generic       // generic ewise
33 (
34     // input/output:
35     GrB_Matrix C,           // output matrix, static header
36     // input:
37     const GrB_BinaryOp op,  // op to perform C = op (A,B)
38     // tasks from phase1a:
39     const GB_task_struct *restrict TaskList,  // array of structs
40     const int C_ntasks,                         // # of tasks
41     const int C_nthreads,                       // # of threads to use
42     // analysis from phase0:
43     const int64_t *restrict C_to_M,
44     const int64_t *restrict C_to_A,
45     const int64_t *restrict C_to_B,
46     const int C_sparsity,
47     // from GB_emult_sparsity or GB_add_sparsity:
48     const int ewise_method,
49     // from GB_emult_03 and GB_emult_02:
50     const int64_t *restrict Cp_kfirst,
51     // to slice M, A, and/or B,
52     const int64_t *M_ek_slicing, const int M_ntasks, const int M_nthreads,
53     const int64_t *A_ek_slicing, const int A_ntasks, const int A_nthreads,
54     const int64_t *B_ek_slicing, const int B_ntasks, const int B_nthreads,
55     // original input:
56     const GrB_Matrix M,             // optional mask, may be NULL
57     const bool Mask_struct,         // if true, use the only structure of M
58     const bool Mask_comp,           // if true, use !M
59     const GrB_Matrix A,
60     const GrB_Matrix B,
61     GB_Context Context
62 ) ;
63 
64 #endif
65