You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
513 B

  1. #include <Eigen/Dense>
  2. #include <iostream>
  3. using namespace StormEigen;
  4. void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
  5. {
  6. dst.triangularView<Upper>() = src.triangularView<Upper>();
  7. }
  8. int main()
  9. {
  10. MatrixXf m1 = MatrixXf::Ones(4,4);
  11. MatrixXf m2 = MatrixXf::Random(4,4);
  12. std::cout << "m2 before copy:" << std::endl;
  13. std::cout << m2 << std::endl << std::endl;
  14. copyUpperTriangularPart(m2, m1);
  15. std::cout << "m2 after copy:" << std::endl;
  16. std::cout << m2 << std::endl << std::endl;
  17. }