I recently refereed a paper for an `R`

package, where the function `base::Vectorize`

is used. The documentation is given here.

As its name suggests, the function vectorizes a customized function written only for scalars. Unfortunately, it does not given good performance improvement (see here).

I was quite surprised at first sight, but then I realized it is quite similar to broadcasting in `julia`

. The latter is done more conveniently: Say the user has defined a function `f(x)`

for a scalar input `x`

, then `f.(vec_x)`

vectorizes the same function to a vector input `vec_x`

.

© Spark Tseung 2020-2022. Last modified: April 23, 2022.

Website built with Franklin.jl and the Julia programming language,

plus some help from LeXtudio.

Website built with Franklin.jl and the Julia programming language,

plus some help from LeXtudio.