Skip to content

Commit 5720566

Browse files
committed
Update vmap! docstring
1 parent 9fed32f commit 5720566

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/simdfunctionals/map.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,20 @@ end
256256
"""
257257
vmap!(f, destination, a::AbstractArray)
258258
vmap!(f, destination, a::AbstractArray, b::AbstractArray, ...)
259-
Vectorized-`map!`, applying `f` to each element of `a` (or paired elements of `a`, `b`, ...)
259+
Vectorized-`map!`, applying `f` to batches of elements of `a` (or paired batches of `a`, `b`, ...)
260260
and storing the result in `destination`.
261+
262+
The function `f` must accept `VectorizationBase.AbstractSIMD` inputs. Ideally, all this requires
263+
is making sure that `f` is defined to be agnostic with respect to input types, but if the function `f`
264+
contains branches or loops, more work will probably be needed. For example, a function
265+
```julia
266+
f(x) = x > 0 ? log(x) : inv(x)
267+
```
268+
can be rewritten into
269+
```julia
270+
using IfElse
271+
f(x) = IfElse.ifelse(x > 0, log(x), inv(x))
272+
```
261273
"""
262274
function vmap!(
263275
f::F, y::AbstractArray, arg1::AbstractArray, arg2::AbstractArray, args::Vararg{AbstractArray,A}

0 commit comments

Comments
 (0)