The following snippet of code loads a matrix A from disk and attempts to perform a
column-wise concatenation of it with itself. The original dimensions of A are
[ 253120, 1 ] so I expect the output to be [ 253120, 2 ].
const fs = require("fs");
const math = require("mathjs");
function main () {
contents = fs.readFileSync("A.json");
json = JSON.parse(contents);
let A = math.DenseMatrix.fromJSON(json);
console.log(A.size());
let A2 = math.concat(A, A, 1); // This will fail
}
main();
Unfortunately, the script fails with the following error trace:
bash-4.2$ node --max-old-space-size=20000 reproducer1.js
[ 253120, 1 ]
/scratch_user/djusto/tester/node_modules/mathjs/lib/function/matrix/concat.js:91
throw new _IndexError.IndexError(dim, prevDim + 1);
^
Error
/...a larger stack trace .../
bash-4.2$
What could this be? The error suggests a dimensionality error but that couldn't be since I'm concatenating a matrix with itself. Thanks!
Files:
reproduce1.zip
The following snippet of code loads a matrix A from disk and attempts to perform a
column-wise concatenation of it with itself. The original dimensions of A are
[ 253120, 1 ] so I expect the output to be [ 253120, 2 ].
Unfortunately, the script fails with the following error trace:
What could this be? The error suggests a dimensionality error but that couldn't be since I'm concatenating a matrix with itself. Thanks!
Files:
reproduce1.zip