ndarray-vector-fill
Fill an ndarray with component-wise vectors
Introduction
This module is very similar to ndarray-fill
, except it fills an ndarray with vectors. This is useful when you have a function that computes, for example, all three components of a vector at the same time. Using ndarray-fill
, you'd have to compute the function three times over and throw out most of the results.
Installation
$ npm i ndarray-vector-fill
Example
var fill = ;var pool = ;var show = ; var A =
Usage
require('ndarray-vector-fill')(array, func)
Iterates over the first n - 1
dimensions of array
, filling the remaining dimensions with the components of func
.
array
is an ndarray which will be initializedfunc
is a function ofn - 1
arguments that receives the corresponding indices of the firstn - 1
dimensions ofarray
. It should return an array with length matching the last dimension ofarray
.
Returns An initialized array
See Also
License
© 2016 Ricky Reusser. MIT License.