简体   繁体   中英

eigen: how to only compute the lower/upper part in the matrix inner product

I need to compute formula like "A'*A" using Eigen where A is an m by n matrix. The intuitive way to do this is,

result = A.transpose()*A;

But since the result is symmetric, is it possible to only compute the lower or upper part of result?

Yes, using selfadjointView and rankUpdate :

result.setZero();
result.selfadjointView<Lower>().rankUpdate(A.transpose());

This will only update the lower part of result .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM