Yoji KURODA
/
Eigen_test
Eigen matrix library and a test program
Diff: main.cpp
- Revision:
- 0:5971b11ad8ff
- Child:
- 1:ad6e79769c8f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 13 04:07:45 2016 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include <iostream> +#include <Eigen/Dense.h> +using namespace std; +using namespace Eigen; + +int main() { + + Matrix3f A; + Vector3f b; + A << 1,2,3, 4,5,6, 7,8,10; + b << 3, 3, 4; + cout << "Here is the matrix A:\n" << A << endl; + cout << "Here is the vector b:\n" << b << endl; + Vector3f x = A.colPivHouseholderQr().solve(b); + //Vector3f x = A.inverse() * b; + cout << "The solution is:\n" << x << endl; +}