Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:ad6e79769c8f, 2016-10-13 (annotated)
- Committer:
- ykuroda
- Date:
- Thu Oct 13 08:15:23 2016 +0000
- Revision:
- 1:ad6e79769c8f
- Parent:
- 0:5971b11ad8ff
An example program for Eigen
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ykuroda | 0:5971b11ad8ff | 1 | #include "mbed.h" |
| ykuroda | 0:5971b11ad8ff | 2 | #include <iostream> |
| ykuroda | 0:5971b11ad8ff | 3 | #include <Eigen/Dense.h> |
| ykuroda | 0:5971b11ad8ff | 4 | using namespace std; |
| ykuroda | 0:5971b11ad8ff | 5 | using namespace Eigen; |
| ykuroda | 0:5971b11ad8ff | 6 | |
| ykuroda | 0:5971b11ad8ff | 7 | int main() { |
| ykuroda | 0:5971b11ad8ff | 8 | |
| ykuroda | 0:5971b11ad8ff | 9 | Matrix3f A; |
| ykuroda | 0:5971b11ad8ff | 10 | Vector3f b; |
| ykuroda | 0:5971b11ad8ff | 11 | A << 1,2,3, 4,5,6, 7,8,10; |
| ykuroda | 0:5971b11ad8ff | 12 | b << 3, 3, 4; |
| ykuroda | 0:5971b11ad8ff | 13 | cout << "Here is the matrix A:\n" << A << endl; |
| ykuroda | 0:5971b11ad8ff | 14 | cout << "Here is the vector b:\n" << b << endl; |
| ykuroda | 0:5971b11ad8ff | 15 | Vector3f x = A.colPivHouseholderQr().solve(b); |
| ykuroda | 0:5971b11ad8ff | 16 | //Vector3f x = A.inverse() * b; |
| ykuroda | 0:5971b11ad8ff | 17 | cout << "The solution is:\n" << x << endl; |
| ykuroda | 1:ad6e79769c8f | 18 | //printf("b[%g,%g,%g]\n", x(0),x(1),x(2)); |
| ykuroda | 0:5971b11ad8ff | 19 | } |