compile_HouseholderSequence_HouseholderSequence.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <Eigen/LU>
00003 #include <Eigen/QR>
00004 #include <Eigen/Cholesky>
00005 #include <Eigen/Geometry>
00006 #include <Eigen/Jacobi>
00007 #include <Eigen/Eigenvalues>
00008 #include <iostream>
00009 
00010 using namespace Eigen;
00011 using namespace std;
00012 
00013 int main(int, char**)
00014 {
00015   cout.precision(3);
00016   Matrix3d v = Matrix3d::Random();
00017 cout << "The matrix v is:" << endl;
00018 cout << v << endl;
00019 
00020 Vector3d v0(1, v(1,0), v(2,0));
00021 cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl;
00022 Vector3d v1(0, 1, v(2,1));
00023 cout << "The second Householder vector is: v_1 = " << v1.transpose()  << endl;
00024 Vector3d v2(0, 0, 1);
00025 cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl;
00026 
00027 Vector3d h = Vector3d::Random();
00028 cout << "The Householder coefficients are: h = " << h.transpose() << endl;
00029 
00030 Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint();
00031 cout << "The first Householder reflection is represented by H_0 = " << endl;
00032 cout << H0 << endl;
00033 Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint();
00034 cout << "The second Householder reflection is represented by H_1 = " << endl;
00035 cout << H1 << endl;
00036 Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint();
00037 cout << "The third Householder reflection is represented by H_2 = " << endl;
00038 cout << H2 << endl;
00039 cout << "Their product is H_0 H_1 H_2 = " << endl;
00040 cout << H0 * H1 * H2 << endl;
00041 
00042 HouseholderSequence<Matrix3d, Vector3d> hhSeq(v, h);
00043 Matrix3d hhSeqAsMatrix(hhSeq);
00044 cout << "If we construct a HouseholderSequence from v and h" << endl;
00045 cout << "and convert it to a matrix, we get:" << endl;
00046 cout << hhSeqAsMatrix << endl;
00047 
00048   return 0;
00049 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:30:57