time-to-botec/squiggle/node_modules/jstat/test/linearalgebra/triaLowSolve-test.js
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

34 lines
874 B
JavaScript

var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat');
require('../env.js');
suite.addBatch({
'triaLowSolve': {
'topic': function() {
return jStat;
},
'array call': function(jStat) {
var A = [[1, 0, 0], [2, 3, 0], [4, 5, 6]];
var b = [7, 8, 9];
var coef = jStat.triaLowSolve(A, b);
var tol = 0.0001;
assert.epsilon(tol, coef[0], 7.0);
assert.epsilon(tol, coef[1], -2.0);
assert.epsilon(tol, coef[2], -1.5);
},
'matrix call': function(jStat) {
var A = [[1, 0, 0], [2, 3, 0], [4, 5, 6]];
var b = [[7], [8], [9]];
var coef = jStat.triaLowSolve(A, b);
var tol = 0.0001;
assert.epsilon(tol, coef[0][0], 7.0);
assert.epsilon(tol, coef[1][0], -2.0);
assert.epsilon(tol, coef[2][0], -1.5);
}
}
});
suite.export(module);