blob: f109f04e582398075541f1ca72eee89247f05850 [file] [log] [blame]
Brian Silverman72890c22015-09-19 14:37:37 -04001#include <iostream>
2#include <Eigen/Dense>
3
4using namespace std;
5using namespace Eigen;
6
7int main()
8{
9 MatrixXf A = MatrixXf::Random(3, 2);
10 cout << "Here is the matrix A:\n" << A << endl;
11 VectorXf b = VectorXf::Random(3);
12 cout << "Here is the right hand side b:\n" << b << endl;
13 cout << "The least-squares solution is:\n"
Austin Schuh189376f2018-12-20 22:11:15 +110014 << A.bdcSvd(ComputeThinU | ComputeThinV).solve(b) << endl;
Brian Silverman72890c22015-09-19 14:37:37 -040015}