简体   繁体   English

尝试使用 math.net 计算非方阵的伪逆

[英]Trying to use math.net to calculate pseudoinverse of non square matrix

I am trying to use math.net library to compute the pseudoinverse of a matrix, but so far I have gotten an error telling me when I try to use this below code :我正在尝试使用math.net库来计算矩阵的伪逆,但到目前为止,当我尝试使用以下代码时,我收到了一个错误提示:

   B = A.Inverse();

that the matrix must be square.矩阵必须是方阵。 However here然而这里

http://iridium.mathdotnet.com/api/mathnet.numerics.linearalgebra/matrix.htm#Inverse http://iridium.mathdotnet.com/api/mathnet.numerics.linearalgebra/matrix.htm#Inverse

it is said that the inverse method calculates the pseudoinverse.据说逆方法计算伪逆。 This is also said here:这也在这里说:

https://mathnetnumerics.codeplex.com/discussions/251084 https://mathnetnumerics.codeplex.com/discussions/251084

Am I using the wrong version of the library?我是否使用了错误版本的库? So far I have been using Math.Net.Numerics3.4.0 , I added a reference to ac# project to MathNetNumerics.dll found in the folder Net4.0到目前为止,我一直在使用Math.Net.Numerics3.4.0 ,我加入到C#项目的引用MathNetNumerics.dll的文件夹中NET4.0发现

Any help will be greatly appreciated.任何帮助将不胜感激。

According to this documentation :根据此文档

inverse(A) if A is square, pseudoinverse otherwise. inverse(A) 如果 A 是方阵,否则为伪逆。

To me this looks like the Matrix.Inverse() method will fail if given a non-invertible (but square) matrix.对我来说,如果给定一个不可逆(但方形)的矩阵,这看起来 Matrix.Inverse() 方法将失败。 This behavior may be intentional.这种行为可能是故意的。 Sometimes a non-invertible matrix represents a serious error that you want to be alerted about.有时,不可逆矩阵表示您想要警告的严重错误。 Also, if you know that the matrix should always be invertible when square, Inverse MAY be slightly faster than PseudoInverse.此外,如果您知道矩阵在平方时应该始终可逆,则 Inverse 可能比 PseudoInverse 稍快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM