This bugzilla service is closed. All entries have been migrated to
Bug 734 - Spline Module: A call to Spline::derivative fails to compile if dimension=1
Summary: Spline Module: A call to Spline::derivative fails to compile if dimension=1
Alias: None
Product: Eigen
Classification: Unclassified
Component: Unsupported modules (show other bugs)
Version: 3.2
Hardware: All All
: Normal Unknown
Assignee: Hauke Heibel
Depends on:
Reported: 2014-01-30 23:15 UTC by Philipp Büttgenbach
Modified: 2019-12-04 12:58 UTC (History)
2 users (show)

Bug demonstration programm and patch for fixing the bug (10.00 KB, application/x-tar)
2014-01-30 23:15 UTC, Philipp Büttgenbach
no flags Details
patch (5.64 KB, text/html)
2015-06-24 17:11 UTC, Alice
no flags Details

Description Philipp Büttgenbach 2014-01-30 23:15:51 UTC
Created attachment 418 [details]
Bug demonstration programm and patch for fixing the bug

Dear Maintainer,

the bug can be demonstrated using Hauke's example from (see enclosed file). The call to
Spline2d::derivative<1> is an extension of Hauke's example inserted
by me.  This call makes this example fail to compile:

$ LANG=C g++ -I/usr/include/eigen3/ eigen-spline-example-from-hauke.cpp
In file included from /usr/include/eigen3/Eigen/Core:300:0,
                 from eigen-spline-example-from-hauke.cpp:4:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h: In instantiation of
'static void Eigen::PlainObjectBase<Derived>::_check_template_params() [with
Derived = Eigen::Array<double, 1, -1, 0, 1, 2>]':
/usr/include/eigen3/Eigen/src/Core/Array.h:127:7:   required from
'Eigen::Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Array()
[with _Scalar = double; int _Rows = 1; int _Cols = -1; int _Options = 0; int
_MaxRows = 1; int _MaxCols = 2]'
/usr/include/eigen3/unsupported/Eigen/src/Splines/Spline.h:339:70:   required
from 'typename Eigen::SplineTraits<Eigen::Spline<Scalar, Dim, Degree>,
DerivativeOrder>::DerivativeType Eigen::Spline<Scalar, Dim,
Degree>::derivatives(Eigen::Spline<Scalar, Dim, Degree>::Scalar,
Eigen::DenseIndex) const [with int DerivativeOrder = 1; _Scalar = double; int
_Dim = 1; int _Degree = -1; typename Eigen::SplineTraits<Eigen::Spline<Scalar,
Dim, Degree>, DerivativeOrder>::DerivativeType = Eigen::Array<double, 1, -1, 0,
1, 2>; Eigen::Spline<Scalar, Dim, Degree>::Scalar = double; Eigen::DenseIndex =
eigen-spline-example-from-hauke.cpp:37:98:   required from here
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:654:7: error:

This bug can be fixed by changing in
/usr/include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h the
DerivativeType from ColMajor to RowMajor (see enclosed patch for details).
With this change everything compiles fine:

$ LANG=C g++ -I/usr/include/eigen3/ -include SplineFwd.h eigen-spline-example-
from-hauke.cpp && echo $?
Comment 1 Christoph Hertzberg 2014-01-31 15:51:48 UTC
The only question is, if someone expects the return type to be column major if it has more than 1 row (or if it is slightly more efficient). This could be achieved by a simple `?:` expression.
I assign it to Hauke and let him decide ...
Comment 2 Hauke Heibel 2014-02-01 21:01:40 UTC
I pushed a fix (though under a misconfigured user name). I took your patch as a starting point and added two changes.

First, I did what Christoph suggested. I keep RowMajor order, if possible. The reason is to keep derivative values of the same order close to each other in memory. 

Second, I also added the fix the the second traits implementation.

Thanks for reporting the isssue and I am happy to see the somebody is using the code!

Comment 3 Alice 2015-06-24 17:11:32 UTC
Created attachment 586 [details]
Comment 4 Nobody 2019-12-04 12:58:27 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.