Closed GaudiestTooth17 closed 3 years ago
For eigenvalues, there is a dedicated function https://play.nim-lang.org/#ix=2LSo
import neo
let m = matrix(@[
@[1f64, 2, 3],
@[4f64, 5, 6],
@[7f64, 8, 9]])
let e = m.eigenvalues()
echo e.real
echo e.img
For normal matrices, the eigenvectors can be read from the column vectors of its Schur decomposition (m.schur()
), but I do not recall whether there is something more general than that in Neo
Something like this should work:
import neo
let
m = matrix(@[
@[1f64, 4, 7],
@[4f64, 5, 8],
@[7f64, 8, 9]
])
s = m.schur()
e = s.eigenvalues.real
f = s.factorization
for i in 0 .. 2:
echo e[i]
echo f.column(i)
Thank you!
Has anyone done this before or have any tips about how to proceed? The documentation says that this feature still needs to be documented and I'm new to nim and neo.