![](/img/trans.png)
[英]How to assign the complex conjugate of the upper triangular matrix to the lower triangular matrix with Eigen
[英]Lower triangular of matrix in eigen
您的文字和示例不匹配。 我將通過三種可能的方式來理解您的問題。 首先,我們將建立矩陣:
Matrix3d mat;
mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
如果需要實際的下三角矩陣,則可以使用:
std::cout << Matrix3d(mat.triangularView<Lower>()) << "\n\n";
或類似。 結果是:
1 0 0
4 5 0
7 8 9
請注意示例中缺少的5、8、9。 如果只需要最左邊的列,則可以使用:
std::cout << mat.col(0) << "\n\n";
這使
1
4
7
如果(如您的示例的第二部分所示)想要mat * [1, 0, 0]
則可以進行矩陣乘法(不推薦)或僅構造結果:
Matrix3d z = Matrix3d::Zero();
z.col(0) = mat.col(0);
std::cout << z << "\n\n";
得到與您的示例相同的結果:
1 0 0
4 0 0
7 0 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.