TutorialLinAlgExComputeSolveError.cpp File Reference
#include <iostream>
#include <Eigen/Dense>

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
6  {
7  MatrixXd A = MatrixXd::Random(100, 100);
8  MatrixXd b = MatrixXd::Random(100, 50);
9  MatrixXd x = A.fullPivLu().solve(b);
10  double relative_error = (A * x - b).norm() / b.norm(); // norm() is L2 norm
11  std::cout << "The relative error is:\n" << relative_error << std::endl;
12 }
Scalar * b
Definition: benchVecAdd.cpp:17
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
list x
Definition: plotDoE.py:28

References b, and plotDoE::x.