【问题标题】:How do you compute an orthogonal basis of a matrix using hmatrix?如何使用 hmatrix 计算矩阵的正交基?
【发布时间】:2012-05-08 16:48:34
【问题描述】:

orth(somematrix) 内置在 MATLAB 中,但在 Haskell hmatrix 库中似乎不可用。

【问题讨论】:

  • 他们说使用 Numeric.LinearAlgebra.Algorithms.qr,但我不知道如何将 orth 写成 qr

标签: haskell matrix orthogonal


【解决方案1】:
import Numeric.LinearAlgebra    

orth :: Field a => Matrix a -> [Vector a]
orth m = toColumns $ fst $ qr m

或无积分

orth = toColumns . fst . qr

Wikipedia有解释。

【讨论】:

    【解决方案2】:

    也许这就是你需要的:

    orth m = toColumns u
            where (u,_,_) = compactSVD m
    

    https://github.com/AlbertoRuiz/hmatrix/issues/10#issuecomment-4077403

    【讨论】:

    • 来自 qr 分解的旋转 q 的列跨越整个空间。如果您想要输入矩阵 m 的范围空间的正交基,您必须仅从 q 中获取 rank m 列(矩阵秩使用 SVD 进行数值估计)。或者,您可以使用上面的 compatSVD,但基向量会有所不同。
    猜你喜欢
    • 1970-01-01
    • 2013-05-10
    • 1970-01-01
    • 2014-01-17
    • 2019-09-08
    • 2019-11-06
    • 2015-05-17
    • 1970-01-01
    • 2013-01-10
    相关资源
    最近更新 更多