NDIter#
- class NDIter(x)#
Constructs an NDIter instance.
- Arguments:
x (NDArray)
- NDIter.backstrides#
type: Array.<Number>
- NDIter.coords#
type: Array.<Number>
- NDIter.factors#
type: Array.<Number>
- NDIter.index#
type: Number
- NDIter.length#
type: Number
- NDIter.lengthm1#
type: Number
- NDIter.nd#
type: Number
- NDIter.ndm1#
type: Number
- NDIter.pos#
type: Number
- NDIter.shape#
type: Array.<Number>
- NDIter.shapem1#
type: Array.<Number>
- NDIter.strides#
type: Array.<Number>
- NDIter.x#
type: NDArray
- NDIter.current()#
Returns the current element of the iterator
- Returns:
Object – current
- Returns:
Number – [current.value]
- Returns:
Boolean – current.done
Examples:
import { array } from 'vectorious/core/array'; import { NDIter } from 'vectorious/iterator'; const iter = new NDIter(array([1, 2, 3])); iter.current(); // { value: 1, done: false }
- NDIter.done()#
Returns true if the iterator is done, false otherwise
- Returns:
Boolean –
Examples:
import { array } from 'vectorious/core/array'; import { NDIter } from 'vectorious/iterator'; const iter = new NDIter(array([1, 2, 3])); iter.done(); // false
- NDIter.next()#
Steps to the next position in the iterator. Returns the current index of the iterator, or undefined if done.
- Returns:
Object –
Examples:
import { array } from 'vectorious/core/array'; import { NDIter } from 'vectorious/iterator'; const iter = new NDIter(array([1, 2, 3])); iter.next(); // { value: 2, done: false } iter.next(); // { value: 3, done: false } iter.next(); // { done: true }