mapnd: Mapping function to an nd-array along a specific axis.

Description Usage Arguments Value

Description

mapnd() applies a function along a specific axis/dimension of x. However, if a corresponding column function is available, using mapnd_col() can be more efficient e.g. use mapnd_col(x, colMeans) instead of mapnd(x, mean). For convenience, you can also call mapnd() by supplying a function name, e.g. mapnd(x, "mean"). In this case, mapnd will first lookup any corresponding column vectorised function by calling find_colFunc() and if a colFunc is found, mapnd_col will be used instead for better performance.

Usage

1
2
3
mapnd(x, func, along = 1L, pack_args = FALSE, ...)

mapnd_col(x, colFunc, along = 1L, ...)

Arguments

x

an nd-array.

func

a function to map.

along

the axis to map the function to (dims to collapse).

pack_args

whether to pack arguments for func.

...

other arguments passed to func.

colFunc

a column function.

func_name

a optimised function name.

Value

an array (dimension depending on returned dimension of func)


Crystal-YWu/abftools documentation built on May 10, 2019, 8:22 a.m.