Skip to content

Commit

Permalink
test: check eigs with matrix and options
Browse files Browse the repository at this point in the history
  • Loading branch information
gwhitney committed Oct 6, 2023
1 parent 6d9f759 commit c53a943
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/unit-tests/function/matrix/eigs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c53a943

Please sign in to comment.