How do you compute an orthogonal basis of a matrix using hmatrix?
-
28-10-2019 - |
Question
orth(somematrix)
is built into MATLAB but doesn't seem to be available in the Haskell hmatrix library.
Solution
import Numeric.LinearAlgebra
orth :: Field a => Matrix a -> [Vector a]
orth m = toColumns $ fst $ qr m
or point-free
orth = toColumns . fst . qr
Wikipedia has an explanation.
OTHER TIPS
Perhaps this is what you need:
orth m = toColumns u
where (u,_,_) = compactSVD m
https://github.com/AlbertoRuiz/hmatrix/issues/10#issuecomment-4077403
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow