1 //------------------------------------------------------------------------------
2 // GB_apply.h: definitions for GB_apply
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_APPLY_H
11 #define GB_APPLY_H
12 #include "GB.h"
13 
14 GrB_Info GB_apply                   // C<M> = accum (C, op(A)) or op(A')
15 (
16     GrB_Matrix C,                   // input/output matrix for results
17     const bool C_replace,           // C descriptor
18     const GrB_Matrix M,             // optional mask for C, unused if NULL
19     const bool Mask_comp,           // M descriptor
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_UnaryOp op1,          // unary operator to apply
23         const GrB_BinaryOp op2,         // binary operator to apply
24         const GxB_Scalar scalar,        // scalar to bind to binary operator
25         bool binop_bind1st,             // if true, binop(x,A) else binop(A,y)
26     const GrB_Matrix A,             // first input:  matrix A
27     bool A_transpose,               // A matrix descriptor
28     GB_Context Context
29 ) ;
30 
31 // Cx and A->x may be aliased in GB_apply_op
32 
33 GrB_Info GB_apply_op                // apply a unary operator, Cx = op (A)
34 (
35     GB_void *Cx,                    // output array, of type op->ztype
36         const GrB_UnaryOp op1,          // unary operator to apply
37         const GrB_BinaryOp op2,         // binary operator to apply
38         const GxB_Scalar scalar,        // scalar to bind to binary operator
39         bool binop_bind1st,             // if true, binop(x,Ax) else binop(Ax,y)
40     const GrB_Matrix A,             // input matrix
41     GB_Context Context
42 ) ;
43 
44 GB_PUBLIC   // accessed by the MATLAB tests in GraphBLAS/Test only
45 GrB_Info GB_shallow_op      // create shallow matrix and apply operator
46 (
47     GrB_Matrix C,           // output C, of type op*->ztype, static header
48     const bool C_is_csc,    // desired CSR/CSC format of C
49         const GrB_UnaryOp op1,          // unary operator to apply
50         const GrB_BinaryOp op2,         // binary operator to apply
51         const GxB_Scalar scalar,        // scalar to bind to binary operator
52         bool binop_bind1st,             // if true, binop(x,A) else binop(A,y)
53     const GrB_Matrix A,     // input matrix to typecast
54     GB_Context Context
55 ) ;
56 
57 #endif
58