mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-25 22:34:30 +08:00
Using LU decomposition with complete pivoting for better accuracy.
This commit is contained in:
parent
957c2c291b
commit
b59f045c07
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "SplineFwd.h"
|
#include "SplineFwd.h"
|
||||||
|
|
||||||
|
#include <Eigen/LU>
|
||||||
#include <Eigen/QR>
|
#include <Eigen/QR>
|
||||||
|
|
||||||
namespace Eigen
|
namespace Eigen
|
||||||
@ -404,8 +405,8 @@ namespace Eigen
|
|||||||
A(n - 1, n - 1) = 1;
|
A(n - 1, n - 1) = 1;
|
||||||
|
|
||||||
// Solve
|
// Solve
|
||||||
HouseholderQR<MatrixType> qr(A);
|
FullPivLU<MatrixType> lu(A);
|
||||||
ControlPointVectorType controlPoints = qr.solve(MatrixType(b.transpose())).transpose();
|
ControlPointVectorType controlPoints = lu.solve(MatrixType(b.transpose())).transpose();
|
||||||
|
|
||||||
SplineType spline(knots, controlPoints);
|
SplineType spline(knots, controlPoints);
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ void check_global_interpolation_with_derivatives2d()
|
|||||||
{
|
{
|
||||||
PointType point = spline(knots(i));
|
PointType point = spline(knots(i));
|
||||||
PointType referencePoint = points.col(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 derivative = spline.derivatives(knots(i), 1).col(1);
|
||||||
PointType referenceDerivative = derivatives.col(i);
|
PointType referenceDerivative = derivatives.col(i);
|
||||||
VERIFY((derivative - referenceDerivative).matrix().norm() < 1e-10);
|
VERIFY((derivative - referenceDerivative).matrix().norm() < 1e-10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user