aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src
diff options
context:
space:
mode:
authorGravatar Matthew Powelson <matthew.powelson@swri.org>2020-01-07 16:20:43 -0600
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-01-09 21:29:04 +0000
commit2ea5a715cfc742f086666ebb2a237fa54423814f (patch)
treeedf23b55cd5d5a6c004cbb9420e6f57066055504 /unsupported/Eigen/src
parent9254974115b6d4db305a1c7a2ef23ebc8a4a819a (diff)
Properly initialize b vector in SplineFitting
InterpolateWithDerivative does not initialize the be vector correctly. This issue is discussed In stackoverflow question 48382939.
Diffstat (limited to 'unsupported/Eigen/src')
-rw-r--r--unsupported/Eigen/src/Splines/SplineFitting.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/unsupported/Eigen/src/Splines/SplineFitting.h b/unsupported/Eigen/src/Splines/SplineFitting.h
index 850f78a5e..9f6e8afa0 100644
--- a/unsupported/Eigen/src/Splines/SplineFitting.h
+++ b/unsupported/Eigen/src/Splines/SplineFitting.h
@@ -385,7 +385,7 @@ namespace Eigen
{
const DenseIndex span = SplineType::Span(parameters[i], degree, knots);
- if (derivativeIndices[derivativeIndex] == i)
+ if (derivativeIndex < derivativeIndices.size() && derivativeIndices[derivativeIndex] == i)
{
A.block(row, span - degree, 2, degree + 1)
= SplineType::BasisFunctionDerivatives(parameters[i], 1, degree, knots);
@@ -395,8 +395,9 @@ namespace Eigen
}
else
{
- A.row(row++).segment(span - degree, degree + 1)
+ A.row(row).segment(span - degree, degree + 1)
= SplineType::BasisFunctions(parameters[i], degree, knots);
+ b.col(row++) = points.col(i);
}
}
b.col(0) = points.col(0);