简单的3x3矩阵逆代码(C ++) [英] Simple 3x3 matrix inverse code (C++)
问题描述
计算一个3x3矩阵逆的最简单的方法是什么?
What's the easiest way to compute a 3x3 matrix inverse?
我只是寻找一个简短的代码片段来处理非奇异矩阵,可能使用克拉默的规则。它不需要高度优化。我喜欢简单而不是速度。我不想链接其他库。
I'm just looking for a short code snippet that'll do the trick for non-singular matrices, possibly using Cramer's rule. It doesn't need to be highly optimized. I'd prefer simplicity over speed. I'd rather not link in additional libraries.
推荐答案
为什么你不尝试自己编写代码?把它当作一个挑战。 :)
Why don't you try to code it yourself? Take it as a challenge. :)
对于3×3矩阵
For a 3×3 matrix
矩阵逆是
the matrix inverse is
我假设你知道矩阵的行列式| is。
I'm assuming you know what the determinant of a matrix |A| is.
图片(c) Wolfram | Alpha 和
mathworld.wolfram (06-11-09,
22.06)
Images (c) Wolfram|Alpha and mathworld.wolfram (06-11-09, 22.06)
这篇关于简单的3x3矩阵逆代码(C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!