TemplateKeyword_flexible.cpp File Reference

Go to the source code of this file.

Functions

template<typename Derived1 , typename Derived2 >
void copyUpperTriangularPart (Eigen::MatrixBase< Derived1 > &dst, const Eigen::MatrixBase< Derived2 > &src)
 
int main ()
 

Function Documentation

◆ copyUpperTriangularPart()

template<typename Derived1 , typename Derived2 >
void copyUpperTriangularPart ( Eigen::MatrixBase< Derived1 > &  dst,
const Eigen::MatrixBase< Derived2 > &  src 
)

Definition at line 5 of file TemplateKeyword_flexible.cpp.

6 {
7  /* Note the 'template' keywords in the following line! */
8  dst.template triangularView<Eigen::Upper>() = src.template triangularView<Eigen::Upper>();
9 }

◆ main()

int main ( )

Definition at line 11 of file TemplateKeyword_flexible.cpp.

12 {
15  std::cout << "m2 before copy:" << std::endl;
16  std::cout << m2 << std::endl << std::endl;
17  copyUpperTriangularPart(m2, m1.topLeftCorner(4,4));
18  std::cout << "m2 after copy:" << std::endl;
19  std::cout << m2 << std::endl << std::endl;
20 }
Matrix3d m1
Definition: IOFormat.cpp:2
void copyUpperTriangularPart(Eigen::MatrixBase< Derived1 > &dst, const Eigen::MatrixBase< Derived2 > &src)
MatrixType m2(n_dims)
static const ConstantReturnType Ones()
static const RandomReturnType Random()
Definition: Random.h:114
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182