如何在本征库中获得矩阵的等级? [英] How to get rank of a matrix in Eigen library?

查看:126
本文介绍了如何在本征库中获得矩阵的等级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取等级: //eigen.tuxfamily.org/index.php?title=Main_Page rel = nofollow>特征?

How to get rank of a matrix in eigen?

推荐答案

您需要将矩阵转换为排名揭示分解。例如 FullPivLU 。如果您有 matrix3f ,它看起来像这样:

You need to convert your matrix to a rank-revealing decomposition. For instance FullPivLU. If you have a matrix3f it looks like this :

FullPivLU<Matrix3f> lu_decomp(your_matrix);
auto rank = lu_decomp.rank();

编辑

分解矩阵是获得排名的最常见方法。但是,对于维基百科上的排名文章

Decomposing the matrix is the most common way to get the rank. Although, LU is not the most reliable way to achieve it for floating values as explained on the rank article on wikipedia


应用于计算机上的浮点计算时,基本的
高斯消去(LU分解)可能是不可靠的,应该使用
等级揭示分解代替。有效的
替代方法是奇异值分解(SVD),但是还有
个其他较便宜的选择,例如带有
旋转的QR分解(所谓的排名揭示QR因式分解),比高斯消元在数值上更可靠
。级别的数值确定
需要一个准则,用于确定何时应将诸如SVD中的
奇异值之类的值视为零,实际的
选择取决于矩阵和

When applied to floating point computations on computers, basic Gaussian elimination (LU decomposition) can be unreliable, and a rank-revealing decomposition should be used instead. An effective alternative is the singular value decomposition (SVD), but there are other less expensive choices, such as QR decomposition with pivoting (so-called rank-revealing QR factorization), which are still more numerically robust than Gaussian elimination. Numerical determination of rank requires a criterion for deciding when a value, such as a singular value from the SVD, should be treated as zero, a practical choice which depends on both the matrix and the application.

因此,使用 Eigen :: ColPivHouseholderQR< MatrixType>

这篇关于如何在本征库中获得矩阵的等级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆