2017-01-06 00:01:44 +01:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
|
// for linear algebra.
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2017 Gael Guennebaud <gael.guennebaud@inria.fr>
|
|
|
|
|
//
|
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
|
|
#ifndef EIGEN_ARITHMETIC_SEQUENCE_H
|
|
|
|
|
#define EIGEN_ARITHMETIC_SEQUENCE_H
|
|
|
|
|
|
|
|
|
|
namespace Eigen {
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
// Pseudo keywords: all, last, end
|
|
|
|
|
//--------------------------------------------------------------------------------
|
2017-01-06 00:01:44 +01:00
|
|
|
|
|
|
|
|
struct all_t { all_t() {} };
|
|
|
|
|
static const all_t all;
|
|
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
// minimalistic symbolic scalar type
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
|
|
|
|
|
/** This namespace defines a set of classes and functions to build and evaluate symbolic expressions of scalar type Index.
|
|
|
|
|
* Here is a simple example:
|
|
|
|
|
*
|
|
|
|
|
* \code
|
|
|
|
|
* // First step, defines symbols:
|
|
|
|
|
* struct x_tag {}; static const Symbolic::SymbolExpr<x_tag> x;
|
|
|
|
|
* struct y_tag {}; static const Symbolic::SymbolExpr<y_tag> y;
|
|
|
|
|
* struct z_tag {}; static const Symbolic::SymbolExpr<z_tag> z;
|
|
|
|
|
*
|
|
|
|
|
* // Defines an expression:
|
|
|
|
|
* auto expr = (x+3)/y+z;
|
|
|
|
|
*
|
|
|
|
|
* // And evaluate it: (c++14)
|
|
|
|
|
* std::cout << expr.eval(std::make_tuple(Symbolic::defineValue(x,6),Symbolic::defineValue(y,3),Symbolic::defineValue(z,-13))) << "\n";
|
|
|
|
|
*
|
|
|
|
|
* // In c++98/11, only one symbol per expression is supported for now:
|
|
|
|
|
* auto expr98 = (3-x)/2;
|
|
|
|
|
* std::cout << expr98.eval(Symbolic::defineValue(x,6)) << "\n";
|
|
|
|
|
*
|
|
|
|
|
* It is currently only used internally to define and minipulate the placeholders::last and placeholders::end symbols in Eigen::seq and Eigen::seqN.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-01-10 10:57:08 +01:00
|
|
|
namespace Symbolic {
|
|
|
|
|
|
|
|
|
|
template<typename Tag> class Symbol;
|
|
|
|
|
template<typename Arg0> class NegateExpr;
|
|
|
|
|
template<typename Arg1,typename Arg2> class AddExpr;
|
|
|
|
|
template<typename Arg1,typename Arg2> class ProductExpr;
|
|
|
|
|
template<typename Arg1,typename Arg2> class QuotientExpr;
|
|
|
|
|
|
2017-01-09 23:42:16 +01:00
|
|
|
// A simple wrapper around an Index to provide the eval method.
|
|
|
|
|
// We could also use a free-function symbolic_eval...
|
2017-01-10 10:57:08 +01:00
|
|
|
class ValueExpr {
|
2017-01-09 23:42:16 +01:00
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
ValueExpr(Index val) : m_value(val) {}
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T&) const { return m_value; }
|
|
|
|
|
protected:
|
|
|
|
|
Index m_value;
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
/** \class BaseExpr
|
|
|
|
|
* Common base class of any symbolic expressions
|
|
|
|
|
*/
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename Derived>
|
2017-01-10 10:57:08 +01:00
|
|
|
class BaseExpr
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
|
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
/** Evaluate the expression given the \a values of the symbols.
|
|
|
|
|
*
|
|
|
|
|
* \param values defines the values of the symbols, it can either be a SymbolValue or a std::tuple of SymbolValue
|
|
|
|
|
* as constructed by the defineValue function.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T& values) const { return derived().eval(values); }
|
|
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
NegateExpr<Derived> operator-() const { return NegateExpr<Derived>(derived()); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
AddExpr<Derived,ValueExpr> operator+(Index b) const
|
|
|
|
|
{ return AddExpr<Derived,ValueExpr >(derived(), b); }
|
|
|
|
|
AddExpr<Derived,ValueExpr> operator-(Index a) const
|
|
|
|
|
{ return AddExpr<Derived,ValueExpr >(derived(), -a); }
|
|
|
|
|
QuotientExpr<Derived,ValueExpr> operator/(Index a) const
|
|
|
|
|
{ return QuotientExpr<Derived,ValueExpr>(derived(),a); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
friend AddExpr<Derived,ValueExpr> operator+(Index a, const BaseExpr& b)
|
|
|
|
|
{ return AddExpr<Derived,ValueExpr>(b.derived(), a); }
|
|
|
|
|
friend AddExpr<NegateExpr<Derived>,ValueExpr> operator-(Index a, const BaseExpr& b)
|
|
|
|
|
{ return AddExpr<NegateExpr<Derived>,ValueExpr>(-b.derived(), a); }
|
|
|
|
|
friend AddExpr<ValueExpr,Derived> operator/(Index a, const BaseExpr& b)
|
|
|
|
|
{ return AddExpr<ValueExpr,Derived>(a,b.derived()); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2017-01-10 10:57:08 +01:00
|
|
|
AddExpr<Derived,OtherDerived> operator+(const BaseExpr<OtherDerived> &b) const
|
|
|
|
|
{ return AddExpr<Derived,OtherDerived>(derived(), b.derived()); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2017-01-10 10:57:08 +01:00
|
|
|
AddExpr<Derived,NegateExpr<OtherDerived> > operator-(const BaseExpr<OtherDerived> &b) const
|
|
|
|
|
{ return AddExpr<Derived,NegateExpr<OtherDerived> >(derived(), -b.derived()); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2017-01-10 11:46:29 +01:00
|
|
|
QuotientExpr<Derived,OtherDerived> operator/(const BaseExpr<OtherDerived> &b) const
|
2017-01-10 10:57:08 +01:00
|
|
|
{ return QuotientExpr<Derived,OtherDerived>(derived(), b.derived()); }
|
2017-01-09 23:42:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct is_symbolic {
|
2017-01-10 10:57:08 +01:00
|
|
|
// BaseExpr has no conversion ctor, so we only to check whether T can be staticaly cast to its base class BaseExpr<T>.
|
|
|
|
|
enum { value = internal::is_convertible<T,BaseExpr<T> >::value };
|
2017-01-09 23:42:16 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
/** Represents the actual value of a symbol identified by its tag
|
|
|
|
|
*
|
|
|
|
|
* It is the return type of defineValue(), and most of the time this is only way it is used.
|
|
|
|
|
*/
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename Tag>
|
2017-01-10 10:57:08 +01:00
|
|
|
class SymbolValue
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 11:46:29 +01:00
|
|
|
/** Default constructor from the value \a val */
|
2017-01-10 10:57:08 +01:00
|
|
|
SymbolValue(Index val) : m_value(val) {}
|
2017-01-10 11:46:29 +01:00
|
|
|
|
|
|
|
|
/** \returns the stored value of the symbol */
|
2017-01-09 23:42:16 +01:00
|
|
|
Index value() const { return m_value; }
|
|
|
|
|
protected:
|
|
|
|
|
Index m_value;
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
template<typename TagT>
|
|
|
|
|
class SymbolExpr : public BaseExpr<SymbolExpr<TagT> >
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
typedef TagT Tag;
|
|
|
|
|
SymbolExpr() {}
|
|
|
|
|
|
|
|
|
|
Index eval(const SymbolValue<Tag> &values) const { return values.value(); }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
|
// C++14 versions suitable for multiple symbols
|
|
|
|
|
template<typename... Types>
|
|
|
|
|
Index eval(const std::tuple<Types...>& values) const { return std::get<SymbolValue<Tag> >(values).value(); }
|
|
|
|
|
#endif
|
2017-01-09 23:42:16 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-10 11:46:29 +01:00
|
|
|
/** Associate the value \a val to the symbol \a symb
|
|
|
|
|
*/
|
2017-01-10 10:57:08 +01:00
|
|
|
template<typename Tag>
|
2017-01-10 11:46:29 +01:00
|
|
|
SymbolValue<Tag> defineValue(SymbolExpr<Tag> /*symb*/,Index val) {
|
2017-01-10 10:57:08 +01:00
|
|
|
return SymbolValue<Tag>(val);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename Arg0>
|
2017-01-10 10:57:08 +01:00
|
|
|
class NegateExpr : public BaseExpr<NegateExpr<Arg0> >
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
NegateExpr(const Arg0& arg0) : m_arg0(arg0) {}
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T& values) const { return -m_arg0.eval(values); }
|
|
|
|
|
protected:
|
|
|
|
|
Arg0 m_arg0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename Arg0, typename Arg1>
|
2017-01-10 10:57:08 +01:00
|
|
|
class AddExpr : public BaseExpr<AddExpr<Arg0,Arg1> >
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
AddExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T& values) const { return m_arg0.eval(values) + m_arg1.eval(values); }
|
|
|
|
|
protected:
|
|
|
|
|
Arg0 m_arg0;
|
|
|
|
|
Arg1 m_arg1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename Arg0, typename Arg1>
|
2017-01-10 10:57:08 +01:00
|
|
|
class ProductExpr : public BaseExpr<ProductExpr<Arg0,Arg1> >
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
ProductExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T& values) const { return m_arg0.eval(values) * m_arg1.eval(values); }
|
|
|
|
|
protected:
|
|
|
|
|
Arg0 m_arg0;
|
|
|
|
|
Arg1 m_arg1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename Arg0, typename Arg1>
|
2017-01-10 10:57:08 +01:00
|
|
|
class QuotientExpr : public BaseExpr<QuotientExpr<Arg0,Arg1> >
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2017-01-10 10:57:08 +01:00
|
|
|
QuotientExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
Index eval(const T& values) const { return m_arg0.eval(values) / m_arg1.eval(values); }
|
|
|
|
|
protected:
|
|
|
|
|
Arg0 m_arg0;
|
|
|
|
|
Arg1 m_arg1;
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
} // end namespace Symbolic
|
2017-01-09 23:42:16 +01:00
|
|
|
|
2017-01-10 10:31:07 +01:00
|
|
|
namespace placeholders {
|
|
|
|
|
|
2017-01-10 10:57:08 +01:00
|
|
|
namespace internal {
|
|
|
|
|
struct symbolic_last_tag {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const Symbolic::SymbolExpr<internal::symbolic_last_tag> last;
|
|
|
|
|
static const Symbolic::AddExpr<Symbolic::SymbolExpr<internal::symbolic_last_tag>,Symbolic::ValueExpr> end(last+1);
|
2017-01-06 00:01:44 +01:00
|
|
|
|
2017-01-10 10:31:07 +01:00
|
|
|
} // end namespace placeholders
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
// integral constant
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
template<int N> struct fix_t {
|
2017-01-06 00:01:44 +01:00
|
|
|
static const int value = N;
|
|
|
|
|
operator int() const { return value; }
|
2017-01-06 13:10:10 +01:00
|
|
|
fix_t (fix_t<N> (*)() ) {}
|
|
|
|
|
fix_t() {}
|
|
|
|
|
// Needed in C++14 to allow fix<N>():
|
|
|
|
|
fix_t operator() () const { return *this; }
|
2017-01-06 00:01:44 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
template<typename T, int Default=Dynamic> struct get_compile_time {
|
|
|
|
|
enum { value = Default };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<int N,int Default> struct get_compile_time<fix_t<N>,Default> {
|
|
|
|
|
enum { value = N };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename T> struct is_compile_time { enum { value = false }; };
|
|
|
|
|
template<int N> struct is_compile_time<fix_t<N> > { enum { value = true }; };
|
|
|
|
|
|
|
|
|
|
#if __cplusplus > 201103L
|
|
|
|
|
template<int N>
|
|
|
|
|
static const fix_t<N> fix{};
|
|
|
|
|
#else
|
|
|
|
|
template<int N>
|
|
|
|
|
inline fix_t<N> fix() { return fix_t<N>(); }
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
2017-01-09 17:35:21 +01:00
|
|
|
// seq(first,last,incr) and seqN(first,size,incr)
|
2017-01-06 00:01:44 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
2017-01-09 17:35:21 +01:00
|
|
|
template<typename FirstType=Index,typename SizeType=Index,typename IncrType=fix_t<1> >
|
2017-01-09 23:42:16 +01:00
|
|
|
class ArithemeticSequence
|
2017-01-09 17:35:21 +01:00
|
|
|
{
|
2017-01-06 00:01:44 +01:00
|
|
|
|
2017-01-09 17:35:21 +01:00
|
|
|
public:
|
2017-01-09 23:42:16 +01:00
|
|
|
ArithemeticSequence(FirstType first, SizeType size) : m_first(first), m_size(size) {}
|
|
|
|
|
ArithemeticSequence(FirstType first, SizeType size, IncrType incr) : m_first(first), m_size(size), m_incr(incr) {}
|
2017-01-06 00:01:44 +01:00
|
|
|
|
2017-01-09 17:35:21 +01:00
|
|
|
enum {
|
|
|
|
|
SizeAtCompileTime = get_compile_time<SizeType>::value,
|
|
|
|
|
IncrAtCompileTime = get_compile_time<IncrType,DynamicIndex>::value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Index size() const { return m_size; }
|
2017-01-10 14:25:30 +01:00
|
|
|
Index first() const { return m_first; }
|
2017-01-09 17:35:21 +01:00
|
|
|
Index operator[](Index i) const { return m_first + i * m_incr; }
|
2017-01-06 00:01:44 +01:00
|
|
|
|
2017-01-09 17:35:21 +01:00
|
|
|
const FirstType& firstObject() const { return m_first; }
|
|
|
|
|
const SizeType& sizeObject() const { return m_size; }
|
|
|
|
|
const IncrType& incrObject() const { return m_incr; }
|
|
|
|
|
|
|
|
|
|
protected:
|
2017-01-06 00:01:44 +01:00
|
|
|
FirstType m_first;
|
|
|
|
|
SizeType m_size;
|
2017-01-06 13:10:10 +01:00
|
|
|
IncrType m_incr;
|
2017-01-06 00:01:44 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-10 11:06:02 +01:00
|
|
|
namespace internal {
|
|
|
|
|
|
2017-01-10 10:28:45 +01:00
|
|
|
template<typename T, typename EnableIf=void> struct cleanup_seq_type { typedef T type; };
|
|
|
|
|
template<typename T> struct cleanup_seq_type<T,typename internal::enable_if<internal::is_integral<T>::value>::type> { typedef Index type; };
|
2017-01-10 09:34:25 +01:00
|
|
|
template<int N> struct cleanup_seq_type<fix_t<N> > { typedef fix_t<N> type; };
|
|
|
|
|
template<int N> struct cleanup_seq_type<fix_t<N> (*)() > { typedef fix_t<N> type; };
|
2017-01-09 17:35:21 +01:00
|
|
|
|
2017-01-10 11:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
template<typename FirstType,typename SizeType,typename IncrType>
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<SizeType>::type,typename internal::cleanup_seq_type<IncrType>::type >
|
2017-01-09 17:35:21 +01:00
|
|
|
seqN(FirstType first, SizeType size, IncrType incr) {
|
2017-01-10 11:06:02 +01:00
|
|
|
return ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<SizeType>::type,typename internal::cleanup_seq_type<IncrType>::type>(first,size,incr);
|
2017-01-06 00:01:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename SizeType>
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<SizeType>::type >
|
2017-01-09 17:35:21 +01:00
|
|
|
seqN(FirstType first, SizeType size) {
|
2017-01-10 11:06:02 +01:00
|
|
|
return ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<SizeType>::type>(first,size);
|
2017-01-06 00:01:44 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-10 10:28:45 +01:00
|
|
|
#if EIGEN_HAS_CXX11
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename FirstType,typename LastType>
|
2017-01-10 10:28:45 +01:00
|
|
|
auto seq(FirstType f, LastType l) -> decltype(seqN(f,(l-f+fix<1>())))
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
2017-01-10 10:28:45 +01:00
|
|
|
return seqN(f,(l-f+fix<1>()));
|
2017-01-09 23:42:16 +01:00
|
|
|
}
|
2017-01-06 13:10:10 +01:00
|
|
|
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename FirstType,typename LastType, typename IncrType>
|
|
|
|
|
auto seq(FirstType f, LastType l, IncrType incr)
|
2017-01-10 11:06:02 +01:00
|
|
|
-> decltype(seqN(f, (l-f+typename internal::cleanup_seq_type<IncrType>::type(incr))
|
|
|
|
|
/ typename internal::cleanup_seq_type<IncrType>::type(incr),typename internal::cleanup_seq_type<IncrType>::type(incr)))
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
2017-01-10 11:06:02 +01:00
|
|
|
typedef typename internal::cleanup_seq_type<IncrType>::type CleanedIncrType;
|
2017-01-09 23:42:16 +01:00
|
|
|
return seqN(f,(l-f+CleanedIncrType(incr))/CleanedIncrType(incr),CleanedIncrType(incr));
|
|
|
|
|
}
|
2017-01-10 10:28:45 +01:00
|
|
|
#else
|
|
|
|
|
template<typename FirstType,typename LastType>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!(Symbolic::is_symbolic<FirstType>::value || Symbolic::is_symbolic<LastType>::value),
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,Index> >::type
|
2017-01-10 10:28:45 +01:00
|
|
|
seq(FirstType f, LastType l)
|
|
|
|
|
{
|
|
|
|
|
return seqN(f,(l-f+1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstTypeDerived,typename LastType>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!Symbolic::is_symbolic<LastType>::value,
|
|
|
|
|
ArithemeticSequence<FirstTypeDerived, Symbolic::AddExpr<Symbolic::AddExpr<Symbolic::NegateExpr<FirstTypeDerived>,Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr> > >::type
|
|
|
|
|
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, LastType l)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
|
|
|
|
return seqN(f.derived(),(l-f.derived()+1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastTypeDerived>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!Symbolic::is_symbolic<FirstType>::value,
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,
|
2017-01-10 10:57:08 +01:00
|
|
|
Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::ValueExpr>,Symbolic::ValueExpr> > >::type
|
|
|
|
|
seq(FirstType f, const Symbolic::BaseExpr<LastTypeDerived> &l)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
|
|
|
|
return seqN(f,(l.derived()-f+1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstTypeDerived,typename LastTypeDerived>
|
2017-01-10 10:57:08 +01:00
|
|
|
ArithemeticSequence<FirstTypeDerived,
|
|
|
|
|
Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::NegateExpr<FirstTypeDerived> >,Symbolic::ValueExpr> >
|
|
|
|
|
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, const Symbolic::BaseExpr<LastTypeDerived> &l)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
|
|
|
|
return seqN(f.derived(),(l.derived()-f.derived()+1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastType, typename IncrType>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!(Symbolic::is_symbolic<FirstType>::value || Symbolic::is_symbolic<LastType>::value),
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,Index,typename internal::cleanup_seq_type<IncrType>::type> >::type
|
2017-01-10 10:28:45 +01:00
|
|
|
seq(FirstType f, LastType l, IncrType incr)
|
|
|
|
|
{
|
2017-01-10 11:06:02 +01:00
|
|
|
typedef typename internal::cleanup_seq_type<IncrType>::type CleanedIncrType;
|
2017-01-10 10:28:45 +01:00
|
|
|
return seqN(f,(l-f+CleanedIncrType(incr))/CleanedIncrType(incr), incr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstTypeDerived,typename LastType, typename IncrType>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!Symbolic::is_symbolic<LastType>::value,
|
2017-01-10 10:28:45 +01:00
|
|
|
ArithemeticSequence<FirstTypeDerived,
|
2017-01-10 10:57:08 +01:00
|
|
|
Symbolic::QuotientExpr<Symbolic::AddExpr<Symbolic::AddExpr<Symbolic::NegateExpr<FirstTypeDerived>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
2017-01-10 11:06:02 +01:00
|
|
|
typename internal::cleanup_seq_type<IncrType>::type> >::type
|
2017-01-10 10:57:08 +01:00
|
|
|
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, LastType l, IncrType incr)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
2017-01-10 11:06:02 +01:00
|
|
|
typedef typename internal::cleanup_seq_type<IncrType>::type CleanedIncrType;
|
2017-01-10 10:28:45 +01:00
|
|
|
return seqN(f.derived(),(l-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastTypeDerived, typename IncrType>
|
2017-01-10 10:57:08 +01:00
|
|
|
typename internal::enable_if<!Symbolic::is_symbolic<FirstType>::value,
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequence<typename internal::cleanup_seq_type<FirstType>::type,
|
2017-01-10 10:57:08 +01:00
|
|
|
Symbolic::QuotientExpr<Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
2017-01-10 11:06:02 +01:00
|
|
|
typename internal::cleanup_seq_type<IncrType>::type> >::type
|
2017-01-10 10:57:08 +01:00
|
|
|
seq(FirstType f, const Symbolic::BaseExpr<LastTypeDerived> &l, IncrType incr)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
2017-01-10 11:06:02 +01:00
|
|
|
typedef typename internal::cleanup_seq_type<IncrType>::type CleanedIncrType;
|
2017-01-10 10:28:45 +01:00
|
|
|
return seqN(f,(l.derived()-f+CleanedIncrType(incr))/CleanedIncrType(incr), incr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstTypeDerived,typename LastTypeDerived, typename IncrType>
|
|
|
|
|
ArithemeticSequence<FirstTypeDerived,
|
2017-01-10 10:57:08 +01:00
|
|
|
Symbolic::QuotientExpr<Symbolic::AddExpr<Symbolic::AddExpr<LastTypeDerived,
|
|
|
|
|
Symbolic::NegateExpr<FirstTypeDerived> >,
|
|
|
|
|
Symbolic::ValueExpr>,
|
|
|
|
|
Symbolic::ValueExpr>,
|
2017-01-10 11:06:02 +01:00
|
|
|
typename internal::cleanup_seq_type<IncrType>::type>
|
2017-01-10 10:57:08 +01:00
|
|
|
seq(const Symbolic::BaseExpr<FirstTypeDerived> &f, const Symbolic::BaseExpr<LastTypeDerived> &l, IncrType incr)
|
2017-01-10 10:28:45 +01:00
|
|
|
{
|
2017-01-10 11:06:02 +01:00
|
|
|
typedef typename internal::cleanup_seq_type<IncrType>::type CleanedIncrType;
|
2017-01-10 10:28:45 +01:00
|
|
|
return seqN(f.derived(),(l.derived()-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2017-01-06 00:01:44 +01:00
|
|
|
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
2017-01-06 21:53:32 +01:00
|
|
|
template<typename T>
|
|
|
|
|
Index size(const T& x) { return x.size(); }
|
|
|
|
|
|
|
|
|
|
template<typename T,std::size_t N>
|
2017-01-10 10:28:45 +01:00
|
|
|
Index size(const T (&) [N]) { return N; }
|
2017-01-06 21:53:32 +01:00
|
|
|
|
2017-01-10 14:25:30 +01:00
|
|
|
template<typename T>
|
|
|
|
|
Index first(const T& x) { return x.first(); }
|
|
|
|
|
|
2017-01-06 13:29:33 +01:00
|
|
|
template<typename T, int XprSize, typename EnableIf = void> struct get_compile_time_size {
|
2017-01-06 15:54:55 +01:00
|
|
|
enum { value = Dynamic };
|
2017-01-06 13:10:10 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-06 13:29:33 +01:00
|
|
|
template<typename T, int XprSize> struct get_compile_time_size<T,XprSize,typename internal::enable_if<((T::SizeAtCompileTime&0)==0)>::type> {
|
2017-01-06 13:10:10 +01:00
|
|
|
enum { value = T::SizeAtCompileTime };
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 22:01:23 +01:00
|
|
|
template<typename T, int XprSize, int N> struct get_compile_time_size<const T (&)[N],XprSize> {
|
|
|
|
|
enum { value = N };
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
#ifdef EIGEN_HAS_CXX11
|
2017-01-06 22:04:49 +01:00
|
|
|
template<typename T, int XprSize, std::size_t N> struct get_compile_time_size<std::array<T,N>,XprSize> {
|
2017-01-06 13:10:10 +01:00
|
|
|
enum { value = N };
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-01-06 15:54:55 +01:00
|
|
|
template<typename T, typename EnableIf = void> struct get_compile_time_incr {
|
|
|
|
|
enum { value = UndefinedIncr };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename SizeType,typename IncrType>
|
2017-01-09 23:42:16 +01:00
|
|
|
struct get_compile_time_incr<ArithemeticSequence<FirstType,SizeType,IncrType> > {
|
2017-01-06 15:54:55 +01:00
|
|
|
enum { value = get_compile_time<IncrType,DynamicIndex>::value };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
// MakeIndexing/make_indexing turn an arbitrary object of type T into something usable by MatrixSlice
|
|
|
|
|
template<typename T,typename EnableIf=void>
|
|
|
|
|
struct MakeIndexing {
|
|
|
|
|
typedef T type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
2017-01-06 15:54:55 +01:00
|
|
|
const T& make_indexing(const T& x, Index /*size*/) { return x; }
|
2017-01-06 00:01:44 +01:00
|
|
|
|
|
|
|
|
struct IntAsArray {
|
2017-01-06 13:10:10 +01:00
|
|
|
enum {
|
|
|
|
|
SizeAtCompileTime = 1
|
|
|
|
|
};
|
2017-01-06 00:01:44 +01:00
|
|
|
IntAsArray(Index val) : m_value(val) {}
|
|
|
|
|
Index operator[](Index) const { return m_value; }
|
|
|
|
|
Index size() const { return 1; }
|
2017-01-10 14:25:30 +01:00
|
|
|
Index first() const { return m_value; }
|
2017-01-06 00:01:44 +01:00
|
|
|
Index m_value;
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 15:54:55 +01:00
|
|
|
template<> struct get_compile_time_incr<IntAsArray> {
|
|
|
|
|
enum { value = 1 }; // 1 or 0 ??
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
// Turn a single index into something that looks like an array (i.e., that exposes a .size(), and operatro[](int) methods)
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct MakeIndexing<T,typename internal::enable_if<internal::is_integral<T>::value>::type> {
|
|
|
|
|
// Here we could simply use Array, but maybe it's less work for the compiler to use
|
|
|
|
|
// a simpler wrapper as IntAsArray
|
|
|
|
|
//typedef Eigen::Array<Index,1,1> type;
|
|
|
|
|
typedef IntAsArray type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Replace symbolic last/end "keywords" by their true runtime value
|
2017-01-10 16:32:06 +01:00
|
|
|
inline Index eval_expr_given_size(Index x, Index /* size */) { return x; }
|
2017-01-06 00:01:44 +01:00
|
|
|
|
2017-01-09 23:42:16 +01:00
|
|
|
template<int N>
|
2017-01-10 11:06:02 +01:00
|
|
|
fix_t<N> eval_expr_given_size(fix_t<N> x, Index /*size*/) { return x; }
|
2017-01-09 23:42:16 +01:00
|
|
|
|
|
|
|
|
template<typename Derived>
|
2017-01-10 11:06:02 +01:00
|
|
|
Index eval_expr_given_size(const Symbolic::BaseExpr<Derived> &x, Index size)
|
2017-01-09 23:42:16 +01:00
|
|
|
{
|
2017-01-10 10:57:08 +01:00
|
|
|
return x.derived().eval(Symbolic::defineValue(placeholders::last,size-1));
|
2017-01-09 23:42:16 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
// Convert a symbolic span into a usable one (i.e., remove last/end "keywords")
|
2017-01-09 23:42:16 +01:00
|
|
|
template<typename T>
|
|
|
|
|
struct make_size_type {
|
2017-01-10 10:57:08 +01:00
|
|
|
typedef typename internal::conditional<Symbolic::is_symbolic<T>::value, Index, T>::type type;
|
2017-01-09 23:42:16 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
template<typename FirstType,typename SizeType,typename IncrType>
|
2017-01-09 23:42:16 +01:00
|
|
|
struct MakeIndexing<ArithemeticSequence<FirstType,SizeType,IncrType> > {
|
|
|
|
|
typedef ArithemeticSequence<Index,typename make_size_type<SizeType>::type,IncrType> type;
|
2017-01-06 00:01:44 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-06 13:10:10 +01:00
|
|
|
template<typename FirstType,typename SizeType,typename IncrType>
|
2017-01-09 23:42:16 +01:00
|
|
|
ArithemeticSequence<Index,typename make_size_type<SizeType>::type,IncrType>
|
|
|
|
|
make_indexing(const ArithemeticSequence<FirstType,SizeType,IncrType>& ids, Index size) {
|
|
|
|
|
return ArithemeticSequence<Index,typename make_size_type<SizeType>::type,IncrType>(
|
2017-01-10 11:06:02 +01:00
|
|
|
eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.sizeObject(),size),ids.incrObject());
|
2017-01-06 00:01:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert a symbolic 'all' into a usable range
|
|
|
|
|
// Implementation-wise, it would be more efficient to not having to store m_size since
|
|
|
|
|
// this information is already in the nested expression. To this end, we would need a
|
|
|
|
|
// get_size(indices, underlying_size); function returning indices.size() by default.
|
|
|
|
|
struct AllRange {
|
|
|
|
|
AllRange(Index size) : m_size(size) {}
|
|
|
|
|
Index operator[](Index i) const { return i; }
|
|
|
|
|
Index size() const { return m_size; }
|
2017-01-10 14:25:30 +01:00
|
|
|
Index first() const { return 0; }
|
2017-01-06 00:01:44 +01:00
|
|
|
Index m_size;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
struct MakeIndexing<all_t> {
|
|
|
|
|
typedef AllRange type;
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-10 16:35:46 +01:00
|
|
|
inline AllRange make_indexing(all_t , Index size) {
|
2017-01-06 00:01:44 +01:00
|
|
|
return AllRange(size);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-06 13:29:33 +01:00
|
|
|
template<int XprSize> struct get_compile_time_size<AllRange,XprSize> {
|
|
|
|
|
enum { value = XprSize };
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 15:54:55 +01:00
|
|
|
template<> struct get_compile_time_incr<AllRange> {
|
|
|
|
|
enum { value = 1 };
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
} // end namespace internal
|
|
|
|
|
|
2017-01-10 09:34:25 +01:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
namespace legacy {
|
|
|
|
|
// Here are some initial code that I keep here for now to compare the quality of the code generated by the compilers
|
|
|
|
|
|
|
|
|
|
struct shifted_last {
|
|
|
|
|
explicit shifted_last(int o) : offset(o) {}
|
|
|
|
|
int offset;
|
|
|
|
|
shifted_last operator+ (int x) const { return shifted_last(offset+x); }
|
|
|
|
|
shifted_last operator- (int x) const { return shifted_last(offset-x); }
|
|
|
|
|
int operator- (shifted_last x) const { return offset-x.offset; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct last_t {
|
|
|
|
|
last_t() {}
|
|
|
|
|
shifted_last operator- (int offset) const { return shifted_last(-offset); }
|
|
|
|
|
shifted_last operator+ (int offset) const { return shifted_last(+offset); }
|
|
|
|
|
int operator- (last_t) const { return 0; }
|
|
|
|
|
int operator- (shifted_last x) const { return -x.offset; }
|
|
|
|
|
};
|
|
|
|
|
static const last_t last;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct shifted_end {
|
|
|
|
|
explicit shifted_end(int o) : offset(o) {}
|
|
|
|
|
int offset;
|
|
|
|
|
shifted_end operator+ (int x) const { return shifted_end(offset+x); }
|
|
|
|
|
shifted_end operator- (int x) const { return shifted_end(offset-x); }
|
|
|
|
|
int operator- (shifted_end x) const { return offset-x.offset; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct end_t {
|
|
|
|
|
end_t() {}
|
|
|
|
|
shifted_end operator- (int offset) const { return shifted_end (-offset); }
|
|
|
|
|
shifted_end operator+ (int offset) const { return shifted_end ( offset); }
|
|
|
|
|
int operator- (end_t) const { return 0; }
|
|
|
|
|
int operator- (shifted_end x) const { return -x.offset; }
|
|
|
|
|
};
|
|
|
|
|
static const end_t end;
|
|
|
|
|
|
2017-01-10 16:32:06 +01:00
|
|
|
inline Index eval_expr_given_size(last_t, Index size) { return size-1; }
|
|
|
|
|
inline Index eval_expr_given_size(shifted_last x, Index size) { return size+x.offset-1; }
|
|
|
|
|
inline Index eval_expr_given_size(end_t, Index size) { return size; }
|
|
|
|
|
inline Index eval_expr_given_size(shifted_end x, Index size) { return size+x.offset; }
|
2017-01-10 09:34:25 +01:00
|
|
|
|
|
|
|
|
template<typename FirstType=Index,typename LastType=Index,typename IncrType=fix_t<1> >
|
|
|
|
|
class ArithemeticSequenceProxyWithBounds
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ArithemeticSequenceProxyWithBounds(FirstType f, LastType l) : m_first(f), m_last(l) {}
|
|
|
|
|
ArithemeticSequenceProxyWithBounds(FirstType f, LastType l, IncrType s) : m_first(f), m_last(l), m_incr(s) {}
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
SizeAtCompileTime = -1,
|
|
|
|
|
IncrAtCompileTime = get_compile_time<IncrType,DynamicIndex>::value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Index size() const { return (m_last-m_first+m_incr)/m_incr; }
|
|
|
|
|
Index operator[](Index i) const { return m_first + i * m_incr; }
|
|
|
|
|
|
|
|
|
|
const FirstType& firstObject() const { return m_first; }
|
|
|
|
|
const LastType& lastObject() const { return m_last; }
|
|
|
|
|
const IncrType& incrObject() const { return m_incr; }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
FirstType m_first;
|
|
|
|
|
LastType m_last;
|
|
|
|
|
IncrType m_incr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastType>
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequenceProxyWithBounds<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<LastType>::type >
|
2017-01-10 09:34:25 +01:00
|
|
|
seq(FirstType f, LastType l) {
|
2017-01-10 11:06:02 +01:00
|
|
|
return ArithemeticSequenceProxyWithBounds<typename internal::cleanup_seq_type<FirstType>::type,typename internal::cleanup_seq_type<LastType>::type>(f,l);
|
2017-01-10 09:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastType,typename IncrType>
|
2017-01-10 11:06:02 +01:00
|
|
|
ArithemeticSequenceProxyWithBounds< typename internal::cleanup_seq_type<FirstType>::type,
|
|
|
|
|
typename internal::cleanup_seq_type<LastType>::type,
|
|
|
|
|
typename internal::cleanup_seq_type<IncrType>::type >
|
|
|
|
|
seq(FirstType f, LastType l, IncrType s)
|
|
|
|
|
{
|
|
|
|
|
return ArithemeticSequenceProxyWithBounds<typename internal::cleanup_seq_type<FirstType>::type,
|
|
|
|
|
typename internal::cleanup_seq_type<LastType>::type,
|
|
|
|
|
typename internal::cleanup_seq_type<IncrType>::type>
|
|
|
|
|
(f,l,typename internal::cleanup_seq_type<IncrType>::type(s));
|
2017-01-10 09:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastType,typename IncrType>
|
|
|
|
|
struct get_compile_time_incr<legacy::ArithemeticSequenceProxyWithBounds<FirstType,LastType,IncrType> > {
|
|
|
|
|
enum { value = get_compile_time<IncrType,DynamicIndex>::value };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Convert a symbolic range into a usable one (i.e., remove last/end "keywords")
|
|
|
|
|
template<typename FirstType,typename LastType,typename IncrType>
|
|
|
|
|
struct MakeIndexing<legacy::ArithemeticSequenceProxyWithBounds<FirstType,LastType,IncrType> > {
|
|
|
|
|
typedef legacy::ArithemeticSequenceProxyWithBounds<Index,Index,IncrType> type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename FirstType,typename LastType,typename IncrType>
|
|
|
|
|
legacy::ArithemeticSequenceProxyWithBounds<Index,Index,IncrType>
|
|
|
|
|
make_indexing(const legacy::ArithemeticSequenceProxyWithBounds<FirstType,LastType,IncrType>& ids, Index size) {
|
|
|
|
|
return legacy::ArithemeticSequenceProxyWithBounds<Index,Index,IncrType>(
|
2017-01-10 11:06:02 +01:00
|
|
|
eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.lastObject(),size),ids.incrObject());
|
2017-01-10 09:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-06 00:01:44 +01:00
|
|
|
} // end namespace Eigen
|
|
|
|
|
|
|
|
|
|
#endif // EIGEN_ARITHMETIC_SEQUENCE_H
|