source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/doc/snippets/HouseholderSequence_HouseholderSequence.cpp

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

Doc

File size: 1.3 KB
Line 
1Matrix3d v = Matrix3d::Random();
2cout << "The matrix v is:" << endl;
3cout << v << endl;
4
5Vector3d v0(1, v(1,0), v(2,0));
6cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl;
7Vector3d v1(0, 1, v(2,1));
8cout << "The second Householder vector is: v_1 = " << v1.transpose() << endl;
9Vector3d v2(0, 0, 1);
10cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl;
11
12Vector3d h = Vector3d::Random();
13cout << "The Householder coefficients are: h = " << h.transpose() << endl;
14
15Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint();
16cout << "The first Householder reflection is represented by H_0 = " << endl;
17cout << H0 << endl;
18Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint();
19cout << "The second Householder reflection is represented by H_1 = " << endl;
20cout << H1 << endl;
21Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint();
22cout << "The third Householder reflection is represented by H_2 = " << endl;
23cout << H2 << endl;
24cout << "Their product is H_0 H_1 H_2 = " << endl;
25cout << H0 * H1 * H2 << endl;
26
27HouseholderSequence<Matrix3d, Vector3d> hhSeq(v, h);
28Matrix3d hhSeqAsMatrix(hhSeq);
29cout << "If we construct a HouseholderSequence from v and h" << endl;
30cout << "and convert it to a matrix, we get:" << endl;
31cout << hhSeqAsMatrix << endl;
Note: See TracBrowser for help on using the repository browser.