Registered Member
|
#include <iostream>
#include <Eigen/Core> #include <Eigen/LU> using namespace Eigen; Matrix<double,4,4> jac; Matrix<double,4,1> x,b; jac << 17.7198884285894e+000, 4.11883690761422e+000, 0.00000000000000e+000, -5.24617052307789e-018, 282.964019499566e+003, 8.19019146910978e+003, 610.800232848695e-006, -152.722940051182e-015, 41.4404126373160e+012, 1.19829427705403e+012, 8.00000000000000e+000, 283.033589126674e-006, 0.00000000000000e+000 , 0.00000000000000e+000, 0.00000000000000e+000, 8.00000000000000e+000; b << 10.0000000000000e+003, 100.000000000000e+000, 1.00000000000000e+015, 10.0000000000000e+024; x = jac.fullPivLu().solve(b); //does not give correct result //x = jac.partialPivLu().solve(b); // give correct result, i.e. result of jac*x is equal to b; and the result is the same as that given by matlab's linsolve function |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient