aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2017-01-24 09:39:49 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2017-01-24 09:39:49 +0100
commit41c523a0ab8432a3f3276abaeb8a869cccab6b93 (patch)
tree5e879d7db402bc13da621afc90d7721c17431eef
parent4d302a080c775290acf23935f233cebbe19540f4 (diff)
Rename fix_t to FixedInt
-rw-r--r--Eigen/src/Core/ArithmeticSequence.h18
-rw-r--r--Eigen/src/Core/util/IndexedViewHelper.h4
-rw-r--r--Eigen/src/Core/util/IntegralConstant.h67
-rw-r--r--Eigen/src/Core/util/SymbolicIndex.h34
4 files changed, 63 insertions, 60 deletions
diff --git a/Eigen/src/Core/ArithmeticSequence.h b/Eigen/src/Core/ArithmeticSequence.h
index 646eb5770..c5c8bb105 100644
--- a/Eigen/src/Core/ArithmeticSequence.h
+++ b/Eigen/src/Core/ArithmeticSequence.h
@@ -21,12 +21,12 @@ template<> struct aseq_negate<Index> {
typedef Index type;
};
-template<int N> struct aseq_negate<fix_t<N> > {
- typedef fix_t<-N> type;
+template<int N> struct aseq_negate<FixedInt<N> > {
+ typedef FixedInt<-N> type;
};
// Compilation error in the following case:
-template<> struct aseq_negate<fix_t<DynamicIndex> > {};
+template<> struct aseq_negate<FixedInt<DynamicIndex> > {};
template<typename FirstType,typename SizeType,typename IncrType,
bool FirstIsSymbolic=Symbolic::is_symbolic<FirstType>::value,
@@ -38,7 +38,7 @@ struct aseq_reverse_first_type {
template<typename FirstType,typename SizeType,typename IncrType>
struct aseq_reverse_first_type<FirstType,SizeType,IncrType,true,true> {
typedef Symbolic::AddExpr<FirstType,
- Symbolic::ProductExpr<Symbolic::AddExpr<SizeType,Symbolic::ValueExpr<fix_t<-1> > >,
+ Symbolic::ProductExpr<Symbolic::AddExpr<SizeType,Symbolic::ValueExpr<FixedInt<-1> > >,
Symbolic::ValueExpr<IncrType> >
> type;
};
@@ -50,7 +50,7 @@ struct aseq_reverse_first_type<FirstType,SizeType,IncrType,true,false> {
template<typename FirstType,typename SizeType,typename IncrType>
struct aseq_reverse_first_type<FirstType,SizeType,IncrType,false,true> {
- typedef Symbolic::AddExpr<Symbolic::ProductExpr<Symbolic::AddExpr<SizeType,Symbolic::ValueExpr<fix_t<-1> > >,
+ typedef Symbolic::AddExpr<Symbolic::ProductExpr<Symbolic::AddExpr<SizeType,Symbolic::ValueExpr<FixedInt<-1> > >,
Symbolic::ValueExpr<IncrType> >,
Symbolic::ValueExpr<> > type;
};
@@ -67,7 +67,7 @@ template<typename T> struct cleanup_seq_incr {
// seq(first,last,incr) and seqN(first,size,incr)
//--------------------------------------------------------------------------------
-template<typename FirstType=Index,typename SizeType=Index,typename IncrType=internal::fix_t<1> >
+template<typename FirstType=Index,typename SizeType=Index,typename IncrType=internal::FixedInt<1> >
class ArithmeticSequence;
template<typename FirstType,typename SizeType,typename IncrType>
@@ -222,7 +222,7 @@ seq(FirstType f, LastType l)
template<typename FirstTypeDerived,typename LastType>
typename internal::enable_if<!Symbolic::is_symbolic<LastType>::value,
ArithmeticSequence<FirstTypeDerived, Symbolic::AddExpr<Symbolic::AddExpr<Symbolic::NegateExpr<FirstTypeDerived>,Symbolic::ValueExpr<> >,
- Symbolic::ValueExpr<internal::fix_t<1> > > > >::type
+ Symbolic::ValueExpr<internal::FixedInt<1> > > > >::type
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, LastType l)
{
return seqN(f.derived(),(typename internal::cleanup_index_type<LastType>::type(l)-f.derived()+fix<1>()));
@@ -232,7 +232,7 @@ template<typename FirstType,typename LastTypeDerived>
typename internal::enable_if<!Symbolic::is_symbolic<FirstType>::value,
ArithmeticSequence<typename internal::cleanup_index_type<FirstType>::type,
Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::ValueExpr<> >,
- Symbolic::ValueExpr<internal::fix_t<1> > > > >::type
+ Symbolic::ValueExpr<internal::FixedInt<1> > > > >::type
seq(FirstType f, const Symbolic::BaseExpr<LastTypeDerived> &l)
{
return seqN(typename internal::cleanup_index_type<FirstType>::type(f),(l.derived()-typename internal::cleanup_index_type<FirstType>::type(f)+fix<1>()));
@@ -240,7 +240,7 @@ seq(FirstType f, const Symbolic::BaseExpr<LastTypeDerived> &l)
template<typename FirstTypeDerived,typename LastTypeDerived>
ArithmeticSequence<FirstTypeDerived,
- Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::NegateExpr<FirstTypeDerived> >,Symbolic::ValueExpr<internal::fix_t<1> > > >
+ Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::NegateExpr<FirstTypeDerived> >,Symbolic::ValueExpr<internal::FixedInt<1> > > >
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, const Symbolic::BaseExpr<LastTypeDerived> &l)
{
return seqN(f.derived(),(l.derived()-f.derived()+fix<1>()));
diff --git a/Eigen/src/Core/util/IndexedViewHelper.h b/Eigen/src/Core/util/IndexedViewHelper.h
index 1171b2b2e..ab01c857f 100644
--- a/Eigen/src/Core/util/IndexedViewHelper.h
+++ b/Eigen/src/Core/util/IndexedViewHelper.h
@@ -60,7 +60,7 @@ static const auto end = last+1;
#else
// Using a FixedExpr<1> expression is important here to make sure the compiler
// can fully optimize the computation starting indices with zero overhead.
-static const Symbolic::AddExpr<Symbolic::SymbolExpr<internal::symbolic_last_tag>,Symbolic::ValueExpr<Eigen::internal::fix_t<1> > > end(last+fix<1>());
+static const Symbolic::AddExpr<Symbolic::SymbolExpr<internal::symbolic_last_tag>,Symbolic::ValueExpr<Eigen::internal::FixedInt<1> > > end(last+fix<1>());
#endif
} // end namespace placeholders
@@ -71,7 +71,7 @@ namespace internal {
inline Index eval_expr_given_size(Index x, Index /* size */) { return x; }
template<int N>
-fix_t<N> eval_expr_given_size(fix_t<N> x, Index /*size*/) { return x; }
+FixedInt<N> eval_expr_given_size(FixedInt<N> x, Index /*size*/) { return x; }
template<typename Derived>
Index eval_expr_given_size(const Symbolic::BaseExpr<Derived> &x, Index size)
diff --git a/Eigen/src/Core/util/IntegralConstant.h b/Eigen/src/Core/util/IntegralConstant.h
index 178e4893c..e81cc45f2 100644
--- a/Eigen/src/Core/util/IntegralConstant.h
+++ b/Eigen/src/Core/util/IntegralConstant.h
@@ -15,39 +15,42 @@ namespace Eigen {
namespace internal {
-template<int N> struct fix_t;
-template<int N> class variable_or_fixed;
+template<int N> class FixedInt;
+template<int N> class VariableAndFixedInt;
-template<int N> struct fix_t {
+template<int N> class FixedInt
+{
+public:
static const int value = N;
operator int() const { return value; }
- fix_t() {}
- fix_t(variable_or_fixed<N> other) {
+ FixedInt() {}
+ FixedInt( VariableAndFixedInt<N> other) {
EIGEN_ONLY_USED_FOR_DEBUG(other);
eigen_internal_assert(int(other)==N);
}
- fix_t<-N> operator-() const { return fix_t<-N>(); }
+ FixedInt<-N> operator-() const { return FixedInt<-N>(); }
template<int M>
- fix_t<N+M> operator+(fix_t<M>) const { return fix_t<N+M>(); }
+ FixedInt<N+M> operator+( FixedInt<M>) const { return FixedInt<N+M>(); }
template<int M>
- fix_t<N-M> operator-(fix_t<M>) const { return fix_t<N-M>(); }
+ FixedInt<N-M> operator-( FixedInt<M>) const { return FixedInt<N-M>(); }
#if EIGEN_HAS_CXX14
// Needed in C++14 to allow fix<N>():
- fix_t operator() () const { return *this; }
+ FixedInt operator() () const { return *this; }
- variable_or_fixed<N> operator() (int val) const { return variable_or_fixed<N>(val); }
+ VariableAndFixedInt<N> operator() (int val) const { return VariableAndFixedInt<N>(val); }
#else
- fix_t (fix_t<N> (*)() ) {}
+ FixedInt ( FixedInt<N> (*)() ) {}
#endif
};
-template<int N> class variable_or_fixed {
+template<int N> class VariableAndFixedInt
+{
public:
static const int value = N;
operator int() const { return m_value; }
- variable_or_fixed(int val) { m_value = val; }
+ VariableAndFixedInt(int val) { m_value = val; }
protected:
int m_value;
};
@@ -56,17 +59,17 @@ template<typename T, int Default=Dynamic> struct get_fixed_value {
static const int value = Default;
};
-template<int N,int Default> struct get_fixed_value<fix_t<N>,Default> {
+template<int N,int Default> struct get_fixed_value<FixedInt<N>,Default> {
static const int value = N;
};
#if !EIGEN_HAS_CXX14
-template<int N,int Default> struct get_fixed_value<fix_t<N> (*)(),Default> {
+template<int N,int Default> struct get_fixed_value<FixedInt<N> (*)(),Default> {
static const int value = N;
};
#endif
-template<int N,int Default> struct get_fixed_value<variable_or_fixed<N>,Default> {
+template<int N,int Default> struct get_fixed_value<VariableAndFixedInt<N>,Default> {
static const int value = N ;
};
@@ -77,10 +80,10 @@ struct get_fixed_value<variable_if_dynamic<T,N>,Default> {
template<typename T> Index get_runtime_value(const T &x) { return x; }
#if !EIGEN_HAS_CXX14
-template<int N> Index get_runtime_value(fix_t<N> (*)()) { return N; }
+template<int N> Index get_runtime_value(FixedInt<N> (*)()) { return N; }
#endif
-// Cleanup integer/fix_t/variable_or_fixed/etc types:
+// Cleanup integer/FixedInt/VariableAndFixedInt/etc types:
// By default, no cleanup:
template<typename T, int DynamicKey=Dynamic, typename EnableIf=void> struct cleanup_index_type { typedef T type; };
@@ -89,14 +92,14 @@ template<typename T, int DynamicKey=Dynamic, typename EnableIf=void> struct clea
template<typename T, int DynamicKey> struct cleanup_index_type<T,DynamicKey,typename internal::enable_if<internal::is_integral<T>::value>::type> { typedef Index type; };
#if !EIGEN_HAS_CXX14
-// In c++98/c++11, fix<N> is a pointer to function that we better cleanup to a true fix_t<N>:
-template<int N, int DynamicKey> struct cleanup_index_type<fix_t<N> (*)(), DynamicKey> { typedef fix_t<N> type; };
+// In c++98/c++11, fix<N> is a pointer to function that we better cleanup to a true FixedInt<N>:
+template<int N, int DynamicKey> struct cleanup_index_type<FixedInt<N> (*)(), DynamicKey> { typedef FixedInt<N> type; };
#endif
-// If variable_or_fixed does not match DynamicKey, then we turn it to a pure compile-time value:
-template<int N, int DynamicKey> struct cleanup_index_type<variable_or_fixed<N>, DynamicKey> { typedef fix_t<N> type; };
-// If variable_or_fixed matches DynamicKey, then we turn it to a pure runtime-value (aka Index):
-template<int DynamicKey> struct cleanup_index_type<variable_or_fixed<DynamicKey>, DynamicKey> { typedef Index type; };
+// If VariableAndFixedInt does not match DynamicKey, then we turn it to a pure compile-time value:
+template<int N, int DynamicKey> struct cleanup_index_type<VariableAndFixedInt<N>, DynamicKey> { typedef FixedInt<N> type; };
+// If VariableAndFixedInt matches DynamicKey, then we turn it to a pure runtime-value (aka Index):
+template<int DynamicKey> struct cleanup_index_type<VariableAndFixedInt<DynamicKey>, DynamicKey> { typedef Index type; };
} // end namespace internal
@@ -104,15 +107,15 @@ template<int DynamicKey> struct cleanup_index_type<variable_or_fixed<DynamicKey>
#if EIGEN_HAS_CXX14
template<int N>
-static const internal::fix_t<N> fix{};
+static const internal::FixedInt<N> fix{};
#else
template<int N>
-inline internal::fix_t<N> fix() { return internal::fix_t<N>(); }
+inline internal::FixedInt<N> fix() { return internal::FixedInt<N>(); }
// The generic typename T is mandatory. Otherwise, a code like fix<N> could refer to either the function above or this next overload.
// This way a code like fix<N> can only refer to the previous function.
template<int N,typename T>
-inline internal::variable_or_fixed<N> fix(T val) { return internal::variable_or_fixed<N>(val); }
+inline internal::VariableAndFixedInt<N> fix(T val) { return internal::VariableAndFixedInt<N>(val); }
#endif
#else // EIGEN_PARSED_BY_DOXYGEN
@@ -133,17 +136,17 @@ inline internal::variable_or_fixed<N> fix(T val) { return internal::variable_or_
*
* In c++14, it is implemented as:
* \code
- * template<int N> static const internal::fix_t<N> fix{};
+ * template<int N> static const internal::FixedInt<N> fix{};
* \endcode
- * where internal::fix_t<N> is an internal template class similar to
+ * where internal::FixedInt<N> is an internal template class similar to
* <a href="http://en.cppreference.com/w/cpp/types/integral_constant">\c std::integral_constant </a><tt> <int,N> </tt>
- * Here, \c fix<N> is thus an object of type \c internal::fix_t<N>.
+ * Here, \c fix<N> is thus an object of type \c internal::FixedInt<N>.
*
* In c++98/11, it is implemented as a function:
* \code
- * template<int N> inline internal::fix_t<N> fix();
+ * template<int N> inline internal::FixedInt<N> fix();
* \endcode
- * Here internal::fix_t<N> is thus a pointer to function.
+ * Here internal::FixedInt<N> is thus a pointer to function.
*
* If for some reason you want a true object in c++98 then you can write: \code fix<N>() \endcode which is also valid in c++14.
*
diff --git a/Eigen/src/Core/util/SymbolicIndex.h b/Eigen/src/Core/util/SymbolicIndex.h
index 62058760b..a52510f6a 100644
--- a/Eigen/src/Core/util/SymbolicIndex.h
+++ b/Eigen/src/Core/util/SymbolicIndex.h
@@ -61,7 +61,7 @@ protected:
// Specialization for compile-time value,
// It is similar to ValueExpr(N) but this version helps the compiler to generate better code.
template<int N>
-class ValueExpr<internal::fix_t<N> > {
+class ValueExpr<internal::FixedInt<N> > {
public:
ValueExpr() {}
template<typename T>
@@ -114,30 +114,30 @@ public:
{ return QuotientExpr<ValueExpr<>,Derived>(a,b.derived()); }
template<int N>
- AddExpr<Derived,ValueExpr<internal::fix_t<N> > > operator+(internal::fix_t<N>) const
- { return AddExpr<Derived,ValueExpr<internal::fix_t<N> > >(derived(), ValueExpr<internal::fix_t<N> >()); }
+ AddExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator+(internal::FixedInt<N>) const
+ { return AddExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(), ValueExpr<internal::FixedInt<N> >()); }
template<int N>
- AddExpr<Derived,ValueExpr<internal::fix_t<N> > > operator-(internal::fix_t<N>) const
- { return AddExpr<Derived,ValueExpr<internal::fix_t<-N> > >(derived(), ValueExpr<internal::fix_t<-N> >()); }
+ AddExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator-(internal::FixedInt<N>) const
+ { return AddExpr<Derived,ValueExpr<internal::FixedInt<-N> > >(derived(), ValueExpr<internal::FixedInt<-N> >()); }
template<int N>
- ProductExpr<Derived,ValueExpr<internal::fix_t<N> > > operator*(internal::fix_t<N>) const
- { return ProductExpr<Derived,ValueExpr<internal::fix_t<N> > >(derived(),ValueExpr<internal::fix_t<N> >()); }
+ ProductExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator*(internal::FixedInt<N>) const
+ { return ProductExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(),ValueExpr<internal::FixedInt<N> >()); }
template<int N>
- QuotientExpr<Derived,ValueExpr<internal::fix_t<N> > > operator/(internal::fix_t<N>) const
- { return QuotientExpr<Derived,ValueExpr<internal::fix_t<N> > >(derived(),ValueExpr<internal::fix_t<N> >()); }
+ QuotientExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator/(internal::FixedInt<N>) const
+ { return QuotientExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(),ValueExpr<internal::FixedInt<N> >()); }
template<int N>
- friend AddExpr<Derived,ValueExpr<internal::fix_t<N> > > operator+(internal::fix_t<N>, const BaseExpr& b)
- { return AddExpr<Derived,ValueExpr<internal::fix_t<N> > >(b.derived(), ValueExpr<internal::fix_t<N> >()); }
+ friend AddExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator+(internal::FixedInt<N>, const BaseExpr& b)
+ { return AddExpr<Derived,ValueExpr<internal::FixedInt<N> > >(b.derived(), ValueExpr<internal::FixedInt<N> >()); }
template<int N>
- friend AddExpr<NegateExpr<Derived>,ValueExpr<internal::fix_t<N> > > operator-(internal::fix_t<N>, const BaseExpr& b)
- { return AddExpr<NegateExpr<Derived>,ValueExpr<internal::fix_t<N> > >(-b.derived(), ValueExpr<internal::fix_t<N> >()); }
+ friend AddExpr<NegateExpr<Derived>,ValueExpr<internal::FixedInt<N> > > operator-(internal::FixedInt<N>, const BaseExpr& b)
+ { return AddExpr<NegateExpr<Derived>,ValueExpr<internal::FixedInt<N> > >(-b.derived(), ValueExpr<internal::FixedInt<N> >()); }
template<int N>
- friend ProductExpr<ValueExpr<internal::fix_t<N> >,Derived> operator*(internal::fix_t<N>, const BaseExpr& b)
- { return ProductExpr<ValueExpr<internal::fix_t<N> >,Derived>(ValueExpr<internal::fix_t<N> >(),b.derived()); }
+ friend ProductExpr<ValueExpr<internal::FixedInt<N> >,Derived> operator*(internal::FixedInt<N>, const BaseExpr& b)
+ { return ProductExpr<ValueExpr<internal::FixedInt<N> >,Derived>(ValueExpr<internal::FixedInt<N> >(),b.derived()); }
template<int N>
- friend QuotientExpr<ValueExpr<internal::fix_t<N> >,Derived> operator/(internal::fix_t<N>, const BaseExpr& b)
- { return QuotientExpr<ValueExpr<internal::fix_t<N> > ,Derived>(ValueExpr<internal::fix_t<N> >(),b.derived()); }
+ friend QuotientExpr<ValueExpr<internal::FixedInt<N> >,Derived> operator/(internal::FixedInt<N>, const BaseExpr& b)
+ { return QuotientExpr<ValueExpr<internal::FixedInt<N> > ,Derived>(ValueExpr<internal::FixedInt<N> >(),b.derived()); }
template<typename OtherDerived>