|
| 1 | +function GrB_eWiseAdd(C::T, mask::V, accum::W, op::U, A::T, B::T, |
| 2 | + desc::X) where {T <: Union{GrB_Vector, GrB_Matrix}, U <: Union{GrB_BinaryOp, GrB_Monoid, GrB_Semiring}, |
| 3 | + V <: Union{GrB_Vector, GrB_Matrix, GrB_NULL_Type}, W <: valid_accum_types, X <: valid_desc_types} |
| 4 | + |
| 5 | + T_name = get_struct_name(A) |
| 6 | + U_name = get_struct_name(op) |
| 7 | + |
| 8 | + fn_name = "GrB_eWiseAdd_" * T_name * "_" * U_name |
| 9 | + |
| 10 | + return GrB_Info( |
| 11 | + ccall( |
| 12 | + dlsym(graphblas_lib, fn_name), |
| 13 | + Cint, |
| 14 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 15 | + C.p, mask.p, accum.p, op.p, A.p, B.p, desc.p |
| 16 | + ) |
| 17 | + ) |
| 18 | +end |
| 19 | + |
| 20 | +function GrB_eWiseAdd_Vector_Semiring( # w<Mask> = accum (w, u+v) |
| 21 | + w::GrB_Vector, # input/output vector for results |
| 22 | + mask::T, # optional mask for w, unused if NULL |
| 23 | + accum::U, # optional accum for z=accum(w,t) |
| 24 | + semiring::GrB_Semiring, # defines '+' for t=u+v |
| 25 | + u::GrB_Vector, # first input: vector u |
| 26 | + v::GrB_Vector, # second input: vector v |
| 27 | + desc::V # descriptor for w and mask |
| 28 | +) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 29 | + |
| 30 | + return GrB_Info( |
| 31 | + ccall( |
| 32 | + dlsym(graphblas_lib, "GrB_eWiseAdd_Vector_Semiring"), |
| 33 | + Cint, |
| 34 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 35 | + w.p, mask.p, accum.p, semiring.p, u.p, v.p, desc.p |
| 36 | + ) |
| 37 | + ) |
| 38 | +end |
| 39 | + |
| 40 | +function GrB_eWiseAdd_Vector_Monoid( # w<Mask> = accum (w, u+v) |
| 41 | + w::GrB_Vector, # input/output vector for results |
| 42 | + mask::T, # optional mask for w, unused if NULL |
| 43 | + accum::U, # optional accum for z=accum(w,t) |
| 44 | + monoid::GrB_Monoid, # defines '+' for t=u+v |
| 45 | + u::GrB_Vector, # first input: vector u |
| 46 | + v::GrB_Vector, # second input: vector v |
| 47 | + desc::V # descriptor for w and mask |
| 48 | +) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 49 | + |
| 50 | + return GrB_Info( |
| 51 | + ccall( |
| 52 | + dlsym(graphblas_lib, "GrB_eWiseAdd_Vector_Monoid"), |
| 53 | + Cint, |
| 54 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 55 | + w.p, mask.p, accum.p, monoic.p, u.p, v.p, desc.p |
| 56 | + ) |
| 57 | + ) |
| 58 | +end |
| 59 | + |
| 60 | +function GrB_eWiseAdd_Vector_BinaryOp( # w<Mask> = accum (w, u+v) |
| 61 | + w::GrB_Vector, # input/output vector for results |
| 62 | + mask::T, # optional mask for w, unused if NULL |
| 63 | + accum::U, # optional accum for z=accum(w,t) |
| 64 | + mult::GrB_BinaryOp, # defines '+' for t=u+v |
| 65 | + u::GrB_Vector, # first input: vector u |
| 66 | + v::GrB_Vector, # second input: vector v |
| 67 | + desc::V # descriptor for w and mask |
| 68 | +) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 69 | + |
| 70 | + return GrB_Info( |
| 71 | + ccall( |
| 72 | + dlsym(graphblas_lib, "GrB_eWiseAdd_Vector_BinaryOp"), |
| 73 | + Cint, |
| 74 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 75 | + w.p, mask.p, accum.p, mult.p, u.p, v.p, desc.p |
| 76 | + ) |
| 77 | + ) |
| 78 | +end |
| 79 | + |
| 80 | +function GrB_eWiseAdd_Matrix_Semiring( # C<Mask> = accum (C, A+B) |
| 81 | + C::GrB_Matrix, # input/output matrix for results |
| 82 | + Mask::T, # optional mask for C, unused if NULL |
| 83 | + accum::U, # optional accum for Z=accum(C,T) |
| 84 | + semiring::GrB_Semiring, # defines '+' for T=A+B |
| 85 | + A::GrB_Matrix, # first input: matrix A |
| 86 | + B::GrB_Matrix, # second input: matrix B |
| 87 | + desc::V # descriptor for C, Mask, A, and B |
| 88 | +) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 89 | + |
| 90 | + return GrB_Info( |
| 91 | + ccall( |
| 92 | + dlsym(graphblas_lib, fn_name), |
| 93 | + Cint, |
| 94 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 95 | + C.p, Mask.p, accum.p, semiring.p, A.p, B.p, desc.p |
| 96 | + ) |
| 97 | + ) |
| 98 | +end |
| 99 | + |
| 100 | +function GrB_eWiseAdd_Matrix_Monoid( # C<Mask> = accum (C, A+B) |
| 101 | + C::GrB_Matrix, # input/output matrix for results |
| 102 | + Mask::T, # optional mask for C, unused if NULL |
| 103 | + accum::U, # optional accum for Z=accum(C,T) |
| 104 | + monoid::GrB_Monoid, # defines '+' for T=A+B |
| 105 | + A::GrB_Matrix, # first input: matrix A |
| 106 | + B::GrB_Matrix, # second input: matrix B |
| 107 | + desc::V # descriptor for C, Mask, A, and B |
| 108 | +) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 109 | + |
| 110 | + return GrB_Info( |
| 111 | + ccall( |
| 112 | + dlsym(graphblas_lib, fn_name), |
| 113 | + Cint, |
| 114 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 115 | + C.p, Mask.p, accum.p, monoid.p, A.p, B.p, desc.p |
| 116 | + ) |
| 117 | + ) |
| 118 | +end |
| 119 | + |
| 120 | +function GrB_eWiseAdd_Matrix_BinaryOp( # C<Mask> = accum (C, A+B) |
| 121 | + C::GrB_Matrix, # input/output matrix for results |
| 122 | + Mask::T, # optional mask for C, unused if NULL |
| 123 | + accum::U, # optional accum for Z=accum(C,T) |
| 124 | + mult::GrB_BinaryOp, # defines '+' for T=A+B |
| 125 | + A::GrB_Matrix, # first input: matrix A |
| 126 | + B::GrB_Matrix, # second input: matrix B |
| 127 | + desc::V # descriptor for C, Mask, A, and B |
| 128 | +) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types} |
| 129 | + |
| 130 | + return GrB_Info( |
| 131 | + ccall( |
| 132 | + dlsym(graphblas_lib, fn_name), |
| 133 | + Cint, |
| 134 | + (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), |
| 135 | + C.p, Mask.p, accum.p, mult.p, A.p, B.p, desc.p |
| 136 | + ) |
| 137 | + ) |
| 138 | +end |
0 commit comments