帮我制定一个算法来确定矩阵的秩
我想制作一个程序来确定 C# 控制台应用程序中的给定矩阵的排名。但我无法为此制定算法。你能帮我制定这个算法吗?
I want to make a program which will determine the Rank of a given Matrix in C# Console Application. But I cannot able to make the algorithm for that. Can you please help me make that algorithm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以只使用基本的高斯消去法。计算非零行的数量即可得出排名。但这种方法在数值上并不真正稳健。正如维基百科文章所述,还有一些其他算法,例如奇异值分解 (SVD) 或带有旋转的 QR 分解。对于两者,您应该能够轻松找到基本的实现。
但是,根据需要使用准确的数字,您始终必须考虑计算机中浮点数的 IEEE 表示形式的数值不准确性。
阅读更多相关信息:
http://en.wikipedia.org/wiki/IEEE_754
You can just use the basic Gauss elimination method. Counting the number of non-zero rows will give you the rank. But this method is not really numerically robust. As the wikipedia article says, there are a few other algorithms, such as singular value decomposition (SVD)or QR decomposition with pivoting. For both, you should easily be able to find basic implementations.
But working with accurate numbers as you need for this, you always have to think about the numerical inaccuracies of the IEEE representation of floats in the computer.
Read more about it on:
http://en.wikipedia.org/wiki/IEEE_754