MATLAB 求解 C = A \ B 的 MathNet 等效项是什么
我最近开始使用 MathNet 来实现线性代数,但是在将 MATLAB 函数转换为 MathNet 时遇到一些问题。
在 MATLAB 中,我经常使用反斜杠运算符进行简单求解:
C = A \ B
在 MathNet 中与此等效的是什么?
我使用 C = Inv(A) * B 在一个小矩阵中得到相同的结果,但我不知道结果是否精确。
I've recently begun using MathNet to implement our linear algebra, however I'm having some trouble translation MATLAB functions to MathNet.
In MATLAB I often use the simple solve using the backslash operator:
C = A \ B
What is the equivalent of this in MathNet?
I get the same results in a small matrix using C = Inv(A) * B, but I don't know if the result is as precise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
var C = A.QR().Solve(B);
(使用 QR 分解)对于方阵也:
var C = A.LU().Solve(B);
代码>(使用LU分解)var C = A.QR().Solve(B);
(using QR decomposition)For square matrices also:
var C = A.LU().Solve(B);
(using LU decomposition)我不认为 MathNet 有任何与 Matlab 反斜杠运算符“等价”的东西。有关 Matlab 反斜杠如何工作的一些信息,请参阅此网站:有关 mldivide() 的 Matlab 手册< /a>.我想你可以看看一些求解方法,比如 QRSolve,但我认为它们不会那么容易使用......
“精确”是什么意思?您是在问 MathNet 的 inv() 是否可以精确反转矩阵,或者您只是在问是否可以将 C 计算为 Inv(A)*(B)?
如果你问的是后者,是的,对于方阵Matlab的反斜杠与Inv(A)*(B)大致相同。
I don't think MathNet has any "equivalent" of Matlab's backslash operator. See this site for some info on how Matlab's backslash works: Matlab manual on mldivide(). I guess you could look at some of the solve methods, like QRSolve, but I don't think they will be as easy to use...
What do you mean by "precise"? Are you asking if MathNet's inv() does exact inversion of a matrix, or are you simply asking if you could calculate C as Inv(A)*(B)?
If you are asking the later, yes, for square matrices Matlab's backslash is roughly the same as Inv(A)*(B).
通过我使用 Matlab 和 Math.Net 数值进行的测试:
矩阵 A
向量 B
Matlab: A \ B
Math.Net 数值:A.QR().Solve(B)
两者给出相同的结果(在我的例子中)。我认为 B 作为矩阵也适用。
With the tests I've made using Matlab and Math.Net Numerics:
Matrix A
Vector B
Matlab: A \ B
Math.Net Numerics: A.QR().Solve(B)
Both give the same results (in my case). I think it will work with B being a Matrix also.
如果您使用 ILNumerics.Net 库,
您可以尝试
ILMath.linsolve(A, B);
If you use ILNumerics.Net Library,
You can try
ILMath.linsolve(A, B);