简体   繁体   English

Matlab(R2009b)是否忽略了“mldivide”中的转置运算符?

[英]is Matlab (R2009b) ignoring the transpose operator in “mldivide”?

I am trying to solve the linear system of equations A'*x = B using Matlab's "mldivide" (the backslash operator) in the form: 我试图用以下形式使用Matlab的“mldivide”(反斜杠运算符)求解方程A'* x = B的线性系统:

x_transp = A'\b; 

A is a square sparse matrix and that is all I know about it. A是一个方形稀疏矩阵,这就是我所知道的。 The problem is that the transpose has no effect at all, so the result of the previous line of code is the same than: 问题是转置完全没有效果,因此前一行代码的结果与:

x = A\b;

So, x = x_transp. 所以,x = x_transp。 However, either if I use a new variable such that: 但是,如果我使用新变量,则:

A_transp = A';
x_transpOK1 = A_transp\b;

or simply use: 或者只是使用:

x_transpOK2 = transp(A)\b;

the result is different (x_transpOK1 = x_transpOK2 ≠ x = x_trans). 结果不同(x_transpOK1 = x_transpOK2≠x = x_trans)。 This behavior occurs in Matlab version 7.9.0 (R2009b) but it does not happen in 7.12 (R2011a). 在Matlab版本7.9.0(R2009b)中会出现此行为,但它不会发生在7.12(R2011a)中。

This, however, does not happen with silly examples I have tried (the behavior then is correct). 然而,这并不是我试过的愚蠢的例子(然后行为是正确的)。 The matrices that make this behavior arise are: 产生这种行为的矩阵是:

 A =[0.01   -0.495  0   0   0   0   0   0   0   0
        0        1  0   0   0   0   0   0   0   0
        0        0  1   0   0   0   0   0   0   0
        0        0  0   1   0   0   0   0   0   0
        0   -0.495  0   0   1   0   0   0   0   0
        0        0  0   0   0   1   0   0   0   0
        0        0  0   0   0   0   1   0   0   0
        0        0  0   0   0   0   0   1   0   0
        0        0  0   0   0   0   0   0   1   0
        0        0  0   0   0   0   0   0   0   1];

 b =   [8
        4
        0
        0
        0
        0
        0
        0
        0
        0];

Is it some kind of precision issue? 这是某种精确问题吗? Am I making any fundamental error I cannot see? 我做出了一些我看不到的根本错误吗?

The guys at Mathworks replied: it is a bug in the interpreter, which have been fixed in the next versions. Mathworks的工作人员回答说:这是解释器中的一个错误,已在下一版本中修复。 There is no fix for 7.9.0 and they recommend the following workaround: 没有针对7.9.0的修复,他们建议采用以下解决方法:

A_transp = A';
x = A_transp\b;

I guess this is a great example of the typical advice to always be up-to-date... 我想这是一个典型建议的一个很好的例子,永远是最新的......

My original post on Matlab Answers 我在Matlab Answers上的原帖

The bug report 错误报告

After all the discussion, here is my answer: 经过讨论,这是我的答案:

@Mario_Exec.bat, it seems to me that you might want to take this to the Matlab Answers (mathworks.com/matlabcentral/answers) as maybe someone with knowledge of the actual code (ie a Matlab employee) might be able to help you more specifically. @ Mario_Exec.bat,在我看来你可能想把它带到Matlab Answers(mathworks.com/matlabcentral/answers),因为也许有实际代码知识的人(即Matlab员工)可能能够帮助你进一步来说。 It is an interesting question but it seems there is more going on that might need more knowledge of the actual code and decision trees. 这是一个有趣的问题,但似乎还有更多可能需要更多实际代码和决策树的知识。

Please do post back here when you hear back. 当你收到回复时,请回到这里。 I am curious what they say! 我好奇他们说的话!

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

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