Using LU decomposition with complete pivoting for better accuracy.

This commit is contained in:
Jeff 2014-06-23 19:04:52 -06:00
parent 957c2c291b
commit b59f045c07
2 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@
#include "SplineFwd.h"
#include <Eigen/LU>
#include <Eigen/QR>
namespace Eigen
@ -404,8 +405,8 @@ namespace Eigen
A(n - 1, n - 1) = 1;
// Solve
HouseholderQR<MatrixType> qr(A);
ControlPointVectorType controlPoints = qr.solve(MatrixType(b.transpose())).transpose();
FullPivLU<MatrixType> lu(A);
ControlPointVectorType controlPoints = lu.solve(MatrixType(b.transpose())).transpose();
SplineType spline(knots, controlPoints);

View File

@ -261,7 +261,7 @@ void check_global_interpolation_with_derivatives2d()
{
PointType point = spline(knots(i));
PointType referencePoint = points.col(i);
VERIFY((point - referencePoint).matrix().norm() < 1e-12);
VERIFY((point - referencePoint).matrix().norm() < 1e-10);
PointType derivative = spline.derivatives(knots(i), 1).col(1);
PointType referenceDerivative = derivatives.col(i);
VERIFY((derivative - referenceDerivative).matrix().norm() < 1e-10);