TemplateKeyword_flexible.cpp
Go to the documentation of this file.
1 #include <Eigen/Dense>
2 #include <iostream>
3 
4 using namespace Eigen;
5 
6 template <typename Derived1, typename Derived2>
8 {
9  /* Note the 'template' keywords in the following line! */
10  dst.template triangularView<Upper>() = src.template triangularView<Upper>();
11 }
12 
13 int main()
14 {
15  MatrixXi m1 = MatrixXi::Ones(5,5);
16  MatrixXi m2 = MatrixXi::Random(4,4);
17  std::cout << "m2 before copy:" << std::endl;
18  std::cout << m2 << std::endl << std::endl;
19  copyUpperTriangularPart(m2, m1.topLeftCorner(4,4));
20  std::cout << "m2 after copy:" << std::endl;
21  std::cout << m2 << std::endl << std::endl;
22 }
MatrixType m2(n_dims)
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Matrix3d m1
Definition: IOFormat.cpp:2
void copyUpperTriangularPart(MatrixBase< Derived1 > &dst, const MatrixBase< Derived2 > &src)
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:36:35