function fun(horario, carga, disponibilidade) {
const [d, t] = disponibilidade.size();
return math.chain(horario)
.multiply(carga.map(v => math.sign(v)))
.bitNot()
.bitOr(math.transpose(disponibilidade))
.bitNot()
.sum()
.done();
}
const H3 = math.matrix([
[0, 0, 1, 0, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 1, 0]
]);
const H3_ = math.matrix([
[0, 0, 1, 0, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 1, 0]
], 'sparse');
const K = math.matrix(
[ [ 2, 0, 0, 0, 0 ],
[ 0, 0, 1, 0, 0 ],
[ 0, 0, 0, 1, 0 ],
[ 0, 0, 2, 0, 0 ],
[ 0, 1, 0, 0, 0 ],
[ 0, 0, 1, 0, 0 ],
[ 1, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 1 ],
[ 0, 0, 0, 2, 0 ] ],
'sparse'
);
const D = [
[1, 1, 1, 0],
[0, 1, 0, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 0, 1]
]
assert.equal(fun(H3, K, D), fun(H3_, K, D))
Results in an assertion error.
Using "mathjs": "^5.4.2"
Results in an assertion error.