From c53a943c365b428013a4d0889325072305d09226 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Thu, 5 Oct 2023 17:07:35 -0700 Subject: [PATCH] test: check eigs with matrix and options --- test/unit-tests/function/matrix/eigs.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/unit-tests/function/matrix/eigs.test.js b/test/unit-tests/function/matrix/eigs.test.js index c2ac4427e3..7cbd250679 100644 --- a/test/unit-tests/function/matrix/eigs.test.js +++ b/test/unit-tests/function/matrix/eigs.test.js @@ -30,13 +30,17 @@ describe('eigs', function () { vector => assert(Array.isArray(vector) && vector[0] instanceof Complex) ) - const realSymMatrix = eigs(matrix([[1, 0], [0, 1]])) + const id2 = matrix([[1, 0], [0, 1]]) + const realSymMatrix = eigs(id2) assert(realSymMatrix.values instanceof Matrix) assert.deepStrictEqual(size(realSymMatrix.values), matrix([2])) testEigenvectors(realSymMatrix, vector => { assert(vector instanceof Matrix) assert.deepStrictEqual(size(vector), matrix([2])) }) + // Check we get exact values in this trivial case with lower precision + const rough = eigs(id2, { precision: 1e-6 }) + assert.deepStrictEqual(realSymMatrix, rough) const genericMatrix = eigs(matrix([[0, 1], [-1, 0]])) assert(genericMatrix.values instanceof Matrix)