mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add a DynamicIndex constant for signed quantities and use it to fix the conflict
between Diagonal<S,-1> (the first sub diagonal) and a runtime super/sub diagonal which is now: Diagonal<S,DynamicIndex>
This commit is contained in:
@@ -28,13 +28,18 @@
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
/** This value means that a quantity is not known at compile-time, and that instead the value is
|
||||
/** This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is
|
||||
* stored in some runtime variable.
|
||||
*
|
||||
* Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.
|
||||
*/
|
||||
const int Dynamic = -1;
|
||||
|
||||
/** This value means that a signed quantity (e.g., a signed index) is not known at compile-time, and that instead its value
|
||||
* has to be specified at runtime.
|
||||
*/
|
||||
const int DynamicIndex = 0xffffff;
|
||||
|
||||
/** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().
|
||||
* The value Infinity there means the L-infinity norm.
|
||||
*/
|
||||
|
||||
@@ -80,6 +80,27 @@ template<typename T> class variable_if_dynamic<T, Dynamic>
|
||||
void setValue(T value) { m_value = value; }
|
||||
};
|
||||
|
||||
/** \internal like variable_if_dynamic but for DynamicIndex
|
||||
*/
|
||||
template<typename T, int Value> class variable_if_dynamicindex
|
||||
{
|
||||
public:
|
||||
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamicindex)
|
||||
explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); assert(v == T(Value)); }
|
||||
static T value() { return T(Value); }
|
||||
void setValue(T) {}
|
||||
};
|
||||
|
||||
template<typename T> class variable_if_dynamicindex<T, DynamicIndex>
|
||||
{
|
||||
T m_value;
|
||||
variable_if_dynamicindex() { assert(false); }
|
||||
public:
|
||||
explicit variable_if_dynamicindex(T value) : m_value(value) {}
|
||||
T value() const { return m_value; }
|
||||
void setValue(T value) { m_value = value; }
|
||||
};
|
||||
|
||||
template<typename T> struct functor_traits
|
||||
{
|
||||
enum
|
||||
|
||||
Reference in New Issue
Block a user