1*bf2c3715SXin Li #include <iostream> 2*bf2c3715SXin Li #include <Eigen/Dense> 3*bf2c3715SXin Li 4*bf2c3715SXin Li using namespace std; 5*bf2c3715SXin Li using namespace Eigen; 6*bf2c3715SXin Li main()7*bf2c3715SXin Liint main() 8*bf2c3715SXin Li { 9*bf2c3715SXin Li MatrixXf A = MatrixXf::Random(3, 2); 10*bf2c3715SXin Li cout << "Here is the matrix A:\n" << A << endl; 11*bf2c3715SXin Li VectorXf b = VectorXf::Random(3); 12*bf2c3715SXin Li cout << "Here is the right hand side b:\n" << b << endl; 13*bf2c3715SXin Li cout << "The least-squares solution is:\n" 14*bf2c3715SXin Li << A.bdcSvd(ComputeThinU | ComputeThinV).solve(b) << endl; 15*bf2c3715SXin Li } 16