警告:“对"D"的乘积及其转置进行成对处理,以确保结果为Hermetian." [英] Warning: "Parethesize the multiplication of 'D' and its transpose to ensure the result is Hermetian."
问题描述
如您在上面的屏幕快照中所见,我的Matlab m文件代码中具有以下表达式:
K = P * D * D' * P;
其中,P是nxn矩阵,D是nx1列向量(如果有关系,n = 4).
As you see in the screen shot above, I have the following expression in my Matlab m-file code:
K = P * D * D' * P;
Where, P is an nxn matrix, and D is a nx1 column vector (n=4, if it matters).
为什么会收到此警告消息?
如果我在那里使用或不使用括号,会有什么变化?
Why am I getting this warning message?
What changes if I use or don't use parenthesis there?
推荐答案
浮点算术不是关联的.因此,通常a * (b * c)
不一定会得到与(a * b) * c
相同的结果.
Floating-point arithmetic is not associative. So in general, a * (b * c)
won't necessarily give the same result as (a * b) * c
.
您编写的语句等效于((P * D) * D') * P
,因此编译器警告您,如果您依赖于D * D'
的埃尔米特对称性,则应强制其准确计算出该值.
Your statement as written is equivalent to ((P * D) * D') * P
, so the compiler is warning you that if you're relying on the Hermitian symmetry of D * D'
, you should force it to calculate exactly that.
这篇关于警告:“对"D"的乘积及其转置进行成对处理,以确保结果为Hermetian."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!