Yoji KURODA / Mbed 2 deprecated Eigen_test

Dependencies:   Eigen mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include <iostream>
00003 #include <Eigen/Dense.h>
00004 using namespace std;
00005 using namespace Eigen;
00006 
00007 int main() {
00008 
00009     Matrix3f A;
00010     Vector3f b;
00011     A << 1,2,3, 4,5,6, 7,8,10;
00012     b << 3, 3, 4;
00013     cout << "Here is the matrix A:\n" << A << endl;
00014     cout << "Here is the vector b:\n" << b << endl;
00015     Vector3f x = A.colPivHouseholderQr().solve(b);
00016     //Vector3f x = A.inverse() * b;
00017     cout << "The solution is:\n" << x << endl;
00018     //printf("b[%g,%g,%g]\n", x(0),x(1),x(2));
00019 }