@@ -77,6 +77,28 @@ function Base.map(
77
77
return map! (op, similar (A, t), x, A; mask, accum, desc)
78
78
end
79
79
80
+ """
81
+ map(op::Union{Function, AbstractUnaryOp}, A::GBArray; kwargs...)::GBArray
82
+ map(op::Union{Function, AbstractBinaryOp}, A::GBArray, x; kwargs...)::GBArray
83
+ map(op::Union{Function, AbstractBinaryOp}, x, A::GBArray, kwargs...)::GBArray
84
+
85
+ Transform a GBArray by applying `op` to each element.
86
+
87
+ UnaryOps and single argument functions apply elementwise in the usual fashion.
88
+ BinaryOps and two argument functions require the additional argument `x` which is
89
+ substituted as the first or second operand of `op` depending on its position.
90
+
91
+ # Arguments
92
+ - `op::Union{Function, AbstractUnaryOp, AbstractBinaryOp}`
93
+ - `A::GBArray`
94
+ - `x`: Position dependent argument to binary operators.
95
+
96
+ # Keywords
97
+ - `mask::Union{Nothing, GBVecOrMat} = nothing`: optional mask.
98
+ - `accum::Union{Nothing, AbstractBinaryOp} = nothing`: binary accumulator operation
99
+ where `C[i,j] = accum(C[i,j], T[i,j])` where T is the result of this function before accum is applied.
100
+ - `desc::Union{Nothing, Descriptor} = nothing`
101
+ """
80
102
function Base. map (
81
103
op, x, A:: GBArray ;
82
104
mask = nothing , accum = nothing , desc = nothing
@@ -148,34 +170,6 @@ Base.:-(u::GBArray, x::valid_union; mask = nothing, accum = nothing, desc = noth
148
170
map (BinaryOps. MINUS, u, x; mask, accum, desc)
149
171
150
172
Base.:- (u:: GBArray ) = map (UnaryOps. AINV, u)
151
- """
152
- map(op::UnaryOp, A::GBArray; kwargs...)::GBArray
153
- map(op::BinaryOp, A::GBArray, x; kwargs...)::GBArray
154
- map(op::BinaryOp, x, A::GBArray, kwargs...)::GBArray
155
-
156
- Transform a GBArray by applying `op` to each element.
157
-
158
- UnaryOps apply elementwise in the usual fashion.
159
- BinaryOps require the additional argument `x` which is substituted as the first or second
160
- argument of `op` depending on its position.
161
-
162
- # Arguments
163
- - `op::MonoidBinaryOrRig = BinaryOps.PLUS`: the binary operation which is applied such that
164
- `C[i,j] = op(A[i,j], B[i,j])` for all `i,j` present in either `A` and/or `B`.
165
- - `A::GBArray`: `GBVector` or optionally transposed `GBMatrix`.
166
- - `x`: Position dependent argument to binary operators.
167
-
168
- # Keywords
169
- - `mask::Union{Nothing, GBMatrix} = nothing`: optional mask.
170
- - `accum::Union{Nothing, AbstractBinaryOp} = nothing`: binary accumulator operation
171
- where `C[i,j] = accum(C[i,j], T[i,j])` where T is the result of this function before accum is applied.
172
- - `desc = nothing`
173
- """
174
- function Base. map (
175
- op:: AbstractOp , A:: GBArray , x = nothing ;
176
- mask = nothing , accum = nothing , desc = nothing
177
- )
178
- end
179
173
180
174
"""
181
175
mask!(C::GBArray, A::GBArray, mask::GBArray)
0 commit comments