ndarray-equals
v1.0.3
Published
A simple/not-insane ndarray comparison method that works and obeys sensible rules.
Downloads
3
Maintainers
Readme
ndarray-equals
A simple / not-insane ndarray comparison method that works and obeys sensible rules.
Example:
var ndarray = require('ndarray');
var equals = require('ndarray-equals');
var a1 = ndarray([0,1,2,3], [2,2]);
var a2 = ndarray([0,1,2,3]);
equals(a1, a2); // false
a2 = ndarray([0,1,2,3], [2, 2]);
equals(a1, a2); // true
a2 = ndarray(new Float32Array([0,1,2,3]), [2, 2]);
equals(a1, a2); // false
a2 = undefined;
equals(a1, a2); // false
That's all there is to it really. Two ndarrays are considered equal if and only if they have the same shape, stride, offset, and the data has the same content and constructor. Note that this condition for equality is much stronger than that found in ndarray-ops equals method.
LICENSE: MIT