source: pacpussensors/trunk/Vislab/lib3dv/eigen/doc/examples/TemplateKeyword_simple.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 508 bytes
Line 
1#include <Eigen/Dense>
2#include <iostream>
3
4using namespace Eigen;
5
6void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
7{
8 dst.triangularView<Upper>() = src.triangularView<Upper>();
9}
10
11int main()
12{
13 MatrixXf m1 = MatrixXf::Ones(4,4);
14 MatrixXf m2 = MatrixXf::Random(4,4);
15 std::cout << "m2 before copy:" << std::endl;
16 std::cout << m2 << std::endl << std::endl;
17 copyUpperTriangularPart(m2, m1);
18 std::cout << "m2 after copy:" << std::endl;
19 std::cout << m2 << std::endl << std::endl;
20}
Note: See TracBrowser for help on using the repository browser.