a lot of renaming

internal classes: AaBb -> ei_aa_bb
IntAtRunTimeIfDynamic -> ei_int_if_dynamic
unify UNROLLING_LIMIT (there was no reason to have operator= use
a higher limit)
etc...
This commit is contained in:
Benoit Jacob 2008-03-13 09:33:26 +00:00
parent 16257d44dd
commit afc64f3332
27 changed files with 190 additions and 203 deletions

View File

@ -75,7 +75,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Block) EIGEN_GENERIC_PUBLIC_INTERFACE(Block)
typedef typename MatrixType::AsArg MatRef; typedef typename MatrixType::AsArg MatRef;
@ -142,10 +142,10 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
protected: protected:
MatRef m_matrix; MatRef m_matrix;
IntAtRunTimeIfDynamic<MatrixType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow; ei_int_if_dynamic<MatrixType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
IntAtRunTimeIfDynamic<MatrixType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol; ei_int_if_dynamic<MatrixType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
IntAtRunTimeIfDynamic<RowsAtCompileTime> m_blockRows; ei_int_if_dynamic<RowsAtCompileTime> m_blockRows;
IntAtRunTimeIfDynamic<ColsAtCompileTime> m_blockCols; ei_int_if_dynamic<ColsAtCompileTime> m_blockCols;
}; };
/** \returns a dynamic-size expression of a block in *this. /** \returns a dynamic-size expression of a block in *this.

View File

@ -44,7 +44,7 @@
* Here is an example illustrating this: * Here is an example illustrating this:
* \include class_CwiseBinaryOp.cpp * \include class_CwiseBinaryOp.cpp
* *
* \sa class ScalarProductOp, class ScalarQuotientOp * \sa class ei_scalar_product_op, class ei_scalar_quotient_op
*/ */
template<typename BinaryOp, typename Lhs, typename Rhs> template<typename BinaryOp, typename Lhs, typename Rhs>
struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
@ -64,12 +64,12 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
}; };
template<typename BinaryOp, typename Lhs, typename Rhs> template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOp : NoOperatorEquals, class CwiseBinaryOp : ei_no_assignment_operator,
public MatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > public MatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(CwiseBinaryOp) EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp)
typedef typename Lhs::AsArg LhsRef; typedef typename Lhs::AsArg LhsRef;
typedef typename Rhs::AsArg RhsRef; typedef typename Rhs::AsArg RhsRef;
@ -102,7 +102,7 @@ class CwiseBinaryOp : NoOperatorEquals,
* *
* \sa class CwiseBinaryOp, MatrixBase::operator+ * \sa class CwiseBinaryOp, MatrixBase::operator+
*/ */
struct ScalarSumOp EIGEN_EMPTY_STRUCT { struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; }
}; };
@ -111,7 +111,7 @@ struct ScalarSumOp EIGEN_EMPTY_STRUCT {
* *
* \sa class CwiseBinaryOp, MatrixBase::operator- * \sa class CwiseBinaryOp, MatrixBase::operator-
*/ */
struct ScalarDifferenceOp EIGEN_EMPTY_STRUCT { struct ei_scalar_difference_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; }
}; };
@ -120,7 +120,7 @@ struct ScalarDifferenceOp EIGEN_EMPTY_STRUCT {
* *
* \sa class CwiseBinaryOp, MatrixBase::cwiseProduct() * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct()
*/ */
struct ScalarProductOp EIGEN_EMPTY_STRUCT { struct ei_scalar_product_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; }
}; };
@ -129,7 +129,7 @@ struct ScalarProductOp EIGEN_EMPTY_STRUCT {
* *
* \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient()
*/ */
struct ScalarQuotientOp EIGEN_EMPTY_STRUCT { struct ei_scalar_quotient_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } template<typename Scalar> Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; }
}; };
@ -140,10 +140,10 @@ struct ScalarQuotientOp EIGEN_EMPTY_STRUCT {
* \sa class CwiseBinaryOp, MatrixBase::operator-=() * \sa class CwiseBinaryOp, MatrixBase::operator-=()
*/ */
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
const CwiseBinaryOp<ScalarDifferenceOp, Derived1, Derived2> const CwiseBinaryOp<ei_scalar_difference_op, Derived1, Derived2>
operator-(const MatrixBase<Derived1> &mat1, const MatrixBase<Derived2> &mat2) operator-(const MatrixBase<Derived1> &mat1, const MatrixBase<Derived2> &mat2)
{ {
return CwiseBinaryOp<ScalarDifferenceOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg()); return CwiseBinaryOp<ei_scalar_difference_op, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
} }
/** replaces \c *this by \c *this - \a other. /** replaces \c *this by \c *this - \a other.
@ -158,7 +158,6 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
return *this = *this - other; return *this = *this - other;
} }
/** \relates MatrixBase /** \relates MatrixBase
* *
* \returns an expression of the sum of \a mat1 and \a mat2 * \returns an expression of the sum of \a mat1 and \a mat2
@ -166,10 +165,10 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
* \sa class CwiseBinaryOp, MatrixBase::operator+=() * \sa class CwiseBinaryOp, MatrixBase::operator+=()
*/ */
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
const CwiseBinaryOp<ScalarSumOp, Derived1, Derived2> const CwiseBinaryOp<ei_scalar_sum_op, Derived1, Derived2>
operator+(const MatrixBase<Derived1> &mat1, const MatrixBase<Derived2> &mat2) operator+(const MatrixBase<Derived1> &mat1, const MatrixBase<Derived2> &mat2)
{ {
return CwiseBinaryOp<ScalarSumOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg()); return CwiseBinaryOp<ei_scalar_sum_op, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
} }
/** replaces \c *this by \c *this + \a other. /** replaces \c *this by \c *this + \a other.
@ -184,33 +183,30 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
return *this = *this + other; return *this = *this + other;
} }
/** \returns an expression of the Schur product (coefficient wise product) of *this and \a other /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other
* *
* \sa class CwiseBinaryOp * \sa class CwiseBinaryOp
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived> const CwiseBinaryOp<ei_scalar_product_op, Derived, OtherDerived>
MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived>(asArg(), other.asArg()); return CwiseBinaryOp<ei_scalar_product_op, Derived, OtherDerived>(asArg(), other.asArg());
} }
/** \returns an expression of the coefficient-wise quotient of *this and \a other /** \returns an expression of the coefficient-wise quotient of *this and \a other
* *
* \sa class CwiseBinaryOp * \sa class CwiseBinaryOp
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived> const CwiseBinaryOp<ei_scalar_quotient_op, Derived, OtherDerived>
MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived>(asArg(), other.asArg()); return CwiseBinaryOp<ei_scalar_quotient_op, Derived, OtherDerived>(asArg(), other.asArg());
} }
/** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other
* *
* The template parameter \a CustomBinaryOp is the type of the functor * The template parameter \a CustomBinaryOp is the type of the functor
@ -226,5 +222,4 @@ MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBi
return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(asArg(), other.asArg(), func); return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(asArg(), other.asArg(), func);
} }
#endif // EIGEN_CWISE_BINARY_OP_H #endif // EIGEN_CWISE_BINARY_OP_H

View File

@ -54,12 +54,12 @@ struct ei_traits<CwiseUnaryOp<UnaryOp, MatrixType> >
}; };
template<typename UnaryOp, typename MatrixType> template<typename UnaryOp, typename MatrixType>
class CwiseUnaryOp : NoOperatorEquals, class CwiseUnaryOp : ei_no_assignment_operator,
public MatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> > public MatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(CwiseUnaryOp) EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
typedef typename MatrixType::AsArg MatRef; typedef typename MatrixType::AsArg MatRef;
@ -86,7 +86,7 @@ class CwiseUnaryOp : NoOperatorEquals,
* *
* \sa class CwiseUnaryOp, MatrixBase::operator- * \sa class CwiseUnaryOp, MatrixBase::operator-
*/ */
struct ScalarOppositeOp EIGEN_EMPTY_STRUCT { struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a) const { return -a; } template<typename Scalar> Scalar operator() (const Scalar& a) const { return -a; }
}; };
@ -95,7 +95,7 @@ struct ScalarOppositeOp EIGEN_EMPTY_STRUCT {
* *
* \sa class CwiseUnaryOp, MatrixBase::cwiseAbs * \sa class CwiseUnaryOp, MatrixBase::cwiseAbs
*/ */
struct ScalarAbsOp EIGEN_EMPTY_STRUCT { struct ei_scalar_abs_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a) const { return ei_abs(a); } template<typename Scalar> Scalar operator() (const Scalar& a) const { return ei_abs(a); }
}; };
@ -103,19 +103,19 @@ struct ScalarAbsOp EIGEN_EMPTY_STRUCT {
/** \returns an expression of the opposite of \c *this /** \returns an expression of the opposite of \c *this
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarOppositeOp,Derived> const CwiseUnaryOp<ei_scalar_opposite_op,Derived>
MatrixBase<Derived>::operator-() const MatrixBase<Derived>::operator-() const
{ {
return CwiseUnaryOp<ScalarOppositeOp,Derived>(asArg()); return CwiseUnaryOp<ei_scalar_opposite_op,Derived>(asArg());
} }
/** \returns an expression of the opposite of \c *this /** \returns an expression of the opposite of \c *this
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarAbsOp,Derived> const CwiseUnaryOp<ei_scalar_abs_op,Derived>
MatrixBase<Derived>::cwiseAbs() const MatrixBase<Derived>::cwiseAbs() const
{ {
return CwiseUnaryOp<ScalarAbsOp,Derived>(asArg()); return CwiseUnaryOp<ei_scalar_abs_op,Derived>(asArg());
} }
@ -143,7 +143,7 @@ MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const
* *
* \sa class CwiseUnaryOp, MatrixBase::conjugate() * \sa class CwiseUnaryOp, MatrixBase::conjugate()
*/ */
struct ScalarConjugateOp EIGEN_EMPTY_STRUCT { struct ei_scalar_conjugate_op EIGEN_EMPTY_STRUCT {
template<typename Scalar> Scalar operator() (const Scalar& a) const { return ei_conj(a); } template<typename Scalar> Scalar operator() (const Scalar& a) const { return ei_conj(a); }
}; };
@ -151,10 +151,10 @@ struct ScalarConjugateOp EIGEN_EMPTY_STRUCT {
* *
* \sa adjoint() */ * \sa adjoint() */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarConjugateOp, Derived> const CwiseUnaryOp<ei_scalar_conjugate_op, Derived>
MatrixBase<Derived>::conjugate() const MatrixBase<Derived>::conjugate() const
{ {
return CwiseUnaryOp<ScalarConjugateOp, Derived>(asArg()); return CwiseUnaryOp<ei_scalar_conjugate_op, Derived>(asArg());
} }
/** \internal /** \internal
@ -163,7 +163,7 @@ MatrixBase<Derived>::conjugate() const
* \sa class CwiseUnaryOp, MatrixBase::cast() * \sa class CwiseUnaryOp, MatrixBase::cast()
*/ */
template<typename NewType> template<typename NewType>
struct ScalarCastOp EIGEN_EMPTY_STRUCT { struct ei_scalar_cast_op EIGEN_EMPTY_STRUCT {
typedef NewType result_type; typedef NewType result_type;
template<typename Scalar> NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); } template<typename Scalar> NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); }
}; };
@ -176,14 +176,14 @@ struct ScalarCastOp EIGEN_EMPTY_STRUCT {
* Example: \include MatrixBase_cast.cpp * Example: \include MatrixBase_cast.cpp
* Output: \verbinclude MatrixBase_cast.out * Output: \verbinclude MatrixBase_cast.out
* *
* \sa class CwiseUnaryOp, class ScalarCastOp * \sa class CwiseUnaryOp, class ei_scalar_cast_op
*/ */
template<typename Derived> template<typename Derived>
template<typename NewType> template<typename NewType>
const CwiseUnaryOp<ScalarCastOp<NewType>, Derived> const CwiseUnaryOp<ei_scalar_cast_op<NewType>, Derived>
MatrixBase<Derived>::cast() const MatrixBase<Derived>::cast() const
{ {
return CwiseUnaryOp<ScalarCastOp<NewType>, Derived>(asArg()); return CwiseUnaryOp<ei_scalar_cast_op<NewType>, Derived>(asArg());
} }
/** \internal /** \internal
@ -192,31 +192,31 @@ MatrixBase<Derived>::cast() const
* \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/ * \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/
*/ */
template<typename Scalar> template<typename Scalar>
struct ScalarMultipleOp { struct ei_scalar_multiple_op {
ScalarMultipleOp(const Scalar& other) : m_other(other) {} ei_scalar_multiple_op(const Scalar& other) : m_other(other) {}
Scalar operator() (const Scalar& a) const { return a * m_other; } Scalar operator() (const Scalar& a) const { return a * m_other; }
const Scalar m_other; const Scalar m_other;
}; };
/** \relates MatrixBase \sa class ScalarMultipleOp */ /** \relates MatrixBase \sa class ei_scalar_multiple_op */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarMultipleOp<typename ei_traits<Derived>::Scalar>, Derived> const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::operator*(const Scalar& scalar) const MatrixBase<Derived>::operator*(const Scalar& scalar) const
{ {
return CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived>(asArg(), ScalarMultipleOp<Scalar>(scalar)); return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>(asArg(), ei_scalar_multiple_op<Scalar>(scalar));
} }
/** \relates MatrixBase \sa class ScalarMultipleOp */ /** \relates MatrixBase \sa class ei_scalar_multiple_op */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarMultipleOp<typename ei_traits<Derived>::Scalar>, Derived> const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::operator/(const Scalar& scalar) const MatrixBase<Derived>::operator/(const Scalar& scalar) const
{ {
assert(NumTraits<Scalar>::HasFloatingPoint); assert(NumTraits<Scalar>::HasFloatingPoint);
return CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived> return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
(asArg(), ScalarMultipleOp<Scalar>(static_cast<Scalar>(1) / scalar)); (asArg(), ei_scalar_multiple_op<Scalar>(static_cast<Scalar>(1) / scalar));
} }
/** \sa ScalarMultipleOp */ /** \sa ei_scalar_multiple_op */
template<typename Derived> template<typename Derived>
Derived& Derived&
MatrixBase<Derived>::operator*=(const Scalar& other) MatrixBase<Derived>::operator*=(const Scalar& other)
@ -224,7 +224,7 @@ MatrixBase<Derived>::operator*=(const Scalar& other)
return *this = *this * other; return *this = *this * other;
} }
/** \sa ScalarMultipleOp */ /** \sa ei_scalar_multiple_op */
template<typename Derived> template<typename Derived>
Derived& Derived&
MatrixBase<Derived>::operator/=(const Scalar& other) MatrixBase<Derived>::operator/=(const Scalar& other)

View File

@ -58,7 +58,7 @@ template<typename MatrixType> class DiagonalCoeffs
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(DiagonalCoeffs) EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalCoeffs)
typedef typename MatrixType::AsArg MatRef; typedef typename MatrixType::AsArg MatRef;

View File

@ -51,12 +51,12 @@ struct ei_traits<DiagonalMatrix<CoeffsVectorType> >
}; };
template<typename CoeffsVectorType> template<typename CoeffsVectorType>
class DiagonalMatrix : NoOperatorEquals, class DiagonalMatrix : ei_no_assignment_operator,
public MatrixBase<DiagonalMatrix<CoeffsVectorType> > public MatrixBase<DiagonalMatrix<CoeffsVectorType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(DiagonalMatrix) EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalMatrix)
typedef typename CoeffsVectorType::AsArg CoeffsVecRef; typedef typename CoeffsVectorType::AsArg CoeffsVecRef;

View File

@ -26,17 +26,17 @@
#define EIGEN_DOT_H #define EIGEN_DOT_H
template<int Index, int Size, typename Derived1, typename Derived2> template<int Index, int Size, typename Derived1, typename Derived2>
struct DotUnroller struct ei_dot_unroller
{ {
static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot)
{ {
DotUnroller<Index-1, Size, Derived1, Derived2>::run(v1, v2, dot); ei_dot_unroller<Index-1, Size, Derived1, Derived2>::run(v1, v2, dot);
dot += v1.coeff(Index) * ei_conj(v2.coeff(Index)); dot += v1.coeff(Index) * ei_conj(v2.coeff(Index));
} }
}; };
template<int Size, typename Derived1, typename Derived2> template<int Size, typename Derived1, typename Derived2>
struct DotUnroller<0, Size, Derived1, Derived2> struct ei_dot_unroller<0, Size, Derived1, Derived2>
{ {
static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot)
{ {
@ -45,14 +45,14 @@ struct DotUnroller<0, Size, Derived1, Derived2>
}; };
template<int Index, typename Derived1, typename Derived2> template<int Index, typename Derived1, typename Derived2>
struct DotUnroller<Index, Dynamic, Derived1, Derived2> struct ei_dot_unroller<Index, Dynamic, Derived1, Derived2>
{ {
static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Derived1, typename Derived2> template<int Index, typename Derived1, typename Derived2>
struct DotUnroller<Index, 0, Derived1, Derived2> struct ei_dot_unroller<Index, 0, Derived1, Derived2>
{ {
static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {}
}; };
@ -78,9 +78,9 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
Scalar res; Scalar res;
if(EIGEN_UNROLLED_LOOPS if(EIGEN_UNROLLED_LOOPS
&& SizeAtCompileTime != Dynamic && SizeAtCompileTime != Dynamic
&& SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
DotUnroller<SizeAtCompileTime-1, ei_dot_unroller<SizeAtCompileTime-1,
SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? SizeAtCompileTime : Dynamic, SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic,
Derived, MatrixBase<OtherDerived> > Derived, MatrixBase<OtherDerived> >
::run(*static_cast<const Derived*>(this), other, res); ::run(*static_cast<const Derived*>(this), other, res);
else else
@ -123,7 +123,7 @@ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived
* \sa norm() * \sa norm()
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ScalarMultipleOp<typename ei_traits<Derived>::Scalar>, Derived> const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::normalized() const MatrixBase<Derived>::normalized() const
{ {
return (*this) / norm(); return (*this) / norm();

View File

@ -56,7 +56,7 @@ struct ei_traits<Eval<ExpressionType> >
}; };
}; };
template<typename ExpressionType> class Eval : NoOperatorEquals, template<typename ExpressionType> class Eval : ei_no_assignment_operator,
public Matrix< typename ExpressionType::Scalar, public Matrix< typename ExpressionType::Scalar,
ExpressionType::RowsAtCompileTime, ExpressionType::RowsAtCompileTime,
ExpressionType::ColsAtCompileTime, ExpressionType::ColsAtCompileTime,
@ -81,7 +81,7 @@ template<typename ExpressionType> class Eval : NoOperatorEquals,
ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxRowsAtCompileTime,
ExpressionType::MaxColsAtCompileTime> MatrixType; ExpressionType::MaxColsAtCompileTime> MatrixType;
_EIGEN_BASIC_PUBLIC_INTERFACE(Eval, MatrixType) _EIGEN_GENERIC_PUBLIC_INTERFACE(Eval, MatrixType)
explicit Eval(const ExpressionType& expr) : MatrixType(expr) {} explicit Eval(const ExpressionType& expr) : MatrixType(expr) {}
}; };

View File

@ -51,7 +51,7 @@ struct ei_traits<EvalOMP<ExpressionType> >
}; };
}; };
template<typename ExpressionType> class EvalOMP : NoOperatorEquals, template<typename ExpressionType> class EvalOMP : ei_no_assignment_operator,
public Matrix< typename ExpressionType::Scalar, public Matrix< typename ExpressionType::Scalar,
ExpressionType::RowsAtCompileTime, ExpressionType::RowsAtCompileTime,
ExpressionType::ColsAtCompileTime, ExpressionType::ColsAtCompileTime,
@ -72,7 +72,7 @@ template<typename ExpressionType> class EvalOMP : NoOperatorEquals,
ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxRowsAtCompileTime,
ExpressionType::MaxColsAtCompileTime> MatrixType; ExpressionType::MaxColsAtCompileTime> MatrixType;
_EIGEN_BASIC_PUBLIC_INTERFACE(EvalOMP, MatrixType) _EIGEN_GENERIC_PUBLIC_INTERFACE(EvalOMP, MatrixType)
#ifdef _OPENMP #ifdef _OPENMP
explicit EvalOMP(const ExpressionType& other) explicit EvalOMP(const ExpressionType& other)

View File

@ -46,13 +46,15 @@ template<typename MatrixType> class Map;
template<typename Derived> class Eval; template<typename Derived> class Eval;
template<typename Derived> class EvalOMP; template<typename Derived> class EvalOMP;
struct ScalarProductOp; struct ei_scalar_sum_op;
struct ScalarQuotientOp; struct ei_scalar_difference_op;
struct ScalarOppositeOp; struct ei_scalar_product_op;
struct ScalarConjugateOp; struct ei_scalar_quotient_op;
struct ScalarAbsOp; struct ei_scalar_opposite_op;
template<typename NewType> struct ScalarCastOp; struct ei_scalar_conjugate_op;
template<typename Scalar> struct ScalarMultipleOp; struct ei_scalar_abs_op;
template<typename NewType> struct ei_scalar_cast_op;
template<typename Scalar> struct ei_scalar_multiple_op;
template<typename T> struct Reference template<typename T> struct Reference
{ {

View File

@ -43,12 +43,12 @@ struct ei_traits<Identity<MatrixType> >
}; };
}; };
template<typename MatrixType> class Identity : NoOperatorEquals, template<typename MatrixType> class Identity : ei_no_assignment_operator,
public MatrixBase<Identity<MatrixType> > public MatrixBase<Identity<MatrixType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Identity) EIGEN_GENERIC_PUBLIC_INTERFACE(Identity)
Identity(int rows, int cols) : m_rows(rows), m_cols(cols) Identity(int rows, int cols) : m_rows(rows), m_cols(cols)
{ {
@ -70,8 +70,8 @@ template<typename MatrixType> class Identity : NoOperatorEquals,
} }
protected: protected:
const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const ei_int_if_dynamic<RowsAtCompileTime> m_rows;
const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; const ei_int_if_dynamic<ColsAtCompileTime> m_cols;
}; };
/** \returns an expression of the identity matrix (not necessarily square). /** \returns an expression of the identity matrix (not necessarily square).

View File

@ -55,7 +55,7 @@ template<typename MatrixType> class Map
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Map) EIGEN_GENERIC_PUBLIC_INTERFACE(Map)
private: private:

View File

@ -91,7 +91,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols,
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Matrix) EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix)
enum { StorageOrder = _StorageOrder }; enum { StorageOrder = _StorageOrder };
@ -102,7 +102,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols,
private: private:
MatrixStorage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage; ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage;
AsArg _asArg() const { return AsArg(*this); } AsArg _asArg() const { return AsArg(*this); }
int _rows() const { return m_storage.rows(); } int _rows() const { return m_storage.rows(); }

View File

@ -230,17 +230,17 @@ template<typename Derived> class MatrixBase
/// \name matrix transformation /// \name matrix transformation
//@{ //@{
template<typename NewType> template<typename NewType>
const CwiseUnaryOp<ScalarCastOp<NewType>, Derived> cast() const; const CwiseUnaryOp<ei_scalar_cast_op<NewType>, Derived> cast() const;
const DiagonalMatrix<Derived> asDiagonal() const; const DiagonalMatrix<Derived> asDiagonal() const;
Transpose<Derived> transpose(); Transpose<Derived> transpose();
const Transpose<Derived> transpose() const; const Transpose<Derived> transpose() const;
const CwiseUnaryOp<ScalarConjugateOp, Derived> conjugate() const; const CwiseUnaryOp<ei_scalar_conjugate_op, Derived> conjugate() const;
const Transpose<CwiseUnaryOp<ScalarConjugateOp, Derived> > adjoint() const; const Transpose<CwiseUnaryOp<ei_scalar_conjugate_op, Derived> > adjoint() const;
const CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived> normalized() const; const CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> normalized() const;
//@} //@}
// FIXME not sure about the following name // FIXME not sure about the following name
@ -295,7 +295,7 @@ template<typename Derived> class MatrixBase
/// \name arithemetic operators /// \name arithemetic operators
//@{ //@{
const CwiseUnaryOp<ScalarOppositeOp,Derived> operator-() const; const CwiseUnaryOp<ei_scalar_opposite_op,Derived> operator-() const;
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator+=(const MatrixBase<OtherDerived>& other); Derived& operator+=(const MatrixBase<OtherDerived>& other);
@ -307,10 +307,10 @@ template<typename Derived> class MatrixBase
Derived& operator*=(const Scalar& other); Derived& operator*=(const Scalar& other);
Derived& operator/=(const Scalar& other); Derived& operator/=(const Scalar& other);
const CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived> operator*(const Scalar& scalar) const; const CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> operator*(const Scalar& scalar) const;
const CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived> operator/(const Scalar& scalar) const; const CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> operator/(const Scalar& scalar) const;
friend const CwiseUnaryOp<ScalarMultipleOp<Scalar>, Derived> friend const CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
operator*(const Scalar& scalar, const MatrixBase& matrix) operator*(const Scalar& scalar, const MatrixBase& matrix)
{ return matrix*scalar; } { return matrix*scalar; }
@ -318,14 +318,14 @@ template<typename Derived> class MatrixBase
const Product<Derived, OtherDerived> const Product<Derived, OtherDerived>
lazyProduct(const MatrixBase<OtherDerived>& other) const EIGEN_ALWAYS_INLINE; lazyProduct(const MatrixBase<OtherDerived>& other) const EIGEN_ALWAYS_INLINE;
const CwiseUnaryOp<ScalarAbsOp,Derived> cwiseAbs() const; const CwiseUnaryOp<ei_scalar_abs_op,Derived> cwiseAbs() const;
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived> const CwiseBinaryOp<ei_scalar_product_op, Derived, OtherDerived>
cwiseProduct(const MatrixBase<OtherDerived> &other) const; cwiseProduct(const MatrixBase<OtherDerived> &other) const;
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived> const CwiseBinaryOp<ei_scalar_quotient_op, Derived, OtherDerived>
cwiseQuotient(const MatrixBase<OtherDerived> &other) const; cwiseQuotient(const MatrixBase<OtherDerived> &other) const;
//@} //@}

View File

@ -42,7 +42,7 @@ template<typename MatrixType> class MatrixRef
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(MatrixRef) EIGEN_GENERIC_PUBLIC_INTERFACE(MatrixRef)
MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {} MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {}
~MatrixRef() {} ~MatrixRef() {}

View File

@ -26,8 +26,7 @@
#ifndef EIGEN_MATRIXSTORAGE_H #ifndef EIGEN_MATRIXSTORAGE_H
#define EIGEN_MATRIXSTORAGE_H #define EIGEN_MATRIXSTORAGE_H
/** \class ei_matrix_storage
/** \class MatrixStorage
* *
* \brief Stores the data of a matrix * \brief Stores the data of a matrix
* *
@ -38,15 +37,15 @@
* *
* \sa Matrix * \sa Matrix
*/ */
template<typename T, int Size, int _Rows, int _Cols> class MatrixStorage; template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage;
// purely fixed-size matrix. // purely fixed-size matrix.
template<typename T, int Size, int _Rows, int _Cols> class MatrixStorage template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage
{ {
T m_data[Size]; T m_data[Size];
public: public:
MatrixStorage() {} ei_matrix_storage() {}
MatrixStorage(int,int,int) {} ei_matrix_storage(int,int,int) {}
static int rows(void) {return _Rows;} static int rows(void) {return _Rows;}
static int cols(void) {return _Cols;} static int cols(void) {return _Cols;}
void resize(int,int,int) {} void resize(int,int,int) {}
@ -55,14 +54,14 @@ template<typename T, int Size, int _Rows, int _Cols> class MatrixStorage
}; };
// dynamic-size matrix with fixed-size storage // dynamic-size matrix with fixed-size storage
template<typename T, int Size> class MatrixStorage<T, Size, Dynamic, Dynamic> template<typename T, int Size> class ei_matrix_storage<T, Size, Dynamic, Dynamic>
{ {
T m_data[Size]; T m_data[Size];
int m_rows; int m_rows;
int m_cols; int m_cols;
public: public:
MatrixStorage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {} ei_matrix_storage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {}
~MatrixStorage() {} ~ei_matrix_storage() {}
int rows(void) const {return m_rows;} int rows(void) const {return m_rows;}
int cols(void) const {return m_cols;} int cols(void) const {return m_cols;}
void resize(int, int rows, int cols) void resize(int, int rows, int cols)
@ -75,13 +74,13 @@ template<typename T, int Size> class MatrixStorage<T, Size, Dynamic, Dynamic>
}; };
// dynamic-size matrix with fixed-size storage and fixed width // dynamic-size matrix with fixed-size storage and fixed width
template<typename T, int Size, int _Cols> class MatrixStorage<T, Size, Dynamic, _Cols> template<typename T, int Size, int _Cols> class ei_matrix_storage<T, Size, Dynamic, _Cols>
{ {
T m_data[Size]; T m_data[Size];
int m_rows; int m_rows;
public: public:
MatrixStorage(int, int rows, int) : m_rows(rows) {} ei_matrix_storage(int, int rows, int) : m_rows(rows) {}
~MatrixStorage() {} ~ei_matrix_storage() {}
int rows(void) const {return m_rows;} int rows(void) const {return m_rows;}
int cols(void) const {return _Cols;} int cols(void) const {return _Cols;}
void resize(int size, int rows, int) void resize(int size, int rows, int)
@ -93,13 +92,13 @@ template<typename T, int Size, int _Cols> class MatrixStorage<T, Size, Dynamic,
}; };
// dynamic-size matrix with fixed-size storage and fixed height // dynamic-size matrix with fixed-size storage and fixed height
template<typename T, int Size, int _Rows> class MatrixStorage<T, Size, _Rows, Dynamic> template<typename T, int Size, int _Rows> class ei_matrix_storage<T, Size, _Rows, Dynamic>
{ {
T m_data[Size]; T m_data[Size];
int m_cols; int m_cols;
public: public:
MatrixStorage(int, int, int cols) : m_cols(cols) {} ei_matrix_storage(int, int, int cols) : m_cols(cols) {}
~MatrixStorage() {} ~ei_matrix_storage() {}
int rows(void) const {return _Rows;} int rows(void) const {return _Rows;}
int cols(void) const {return m_cols;} int cols(void) const {return m_cols;}
void resize(int size, int, int cols) void resize(int size, int, int cols)
@ -111,15 +110,15 @@ template<typename T, int Size, int _Rows> class MatrixStorage<T, Size, _Rows, Dy
}; };
// purely dynamic matrix. // purely dynamic matrix.
template<typename T> class MatrixStorage<T, Dynamic, Dynamic, Dynamic> template<typename T> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic>
{ {
T *m_data; T *m_data;
int m_rows; int m_rows;
int m_cols; int m_cols;
public: public:
MatrixStorage(int size, int rows, int cols) ei_matrix_storage(int size, int rows, int cols)
: m_data(new T[size]), m_rows(rows), m_cols(cols) {} : m_data(new T[size]), m_rows(rows), m_cols(cols) {}
~MatrixStorage() { delete[] m_data; } ~ei_matrix_storage() { delete[] m_data; }
int rows(void) const {return m_rows;} int rows(void) const {return m_rows;}
int cols(void) const {return m_cols;} int cols(void) const {return m_cols;}
void resize(int size, int rows, int cols) void resize(int size, int rows, int cols)
@ -137,13 +136,13 @@ template<typename T> class MatrixStorage<T, Dynamic, Dynamic, Dynamic>
}; };
// matrix with dynamic width and fixed height (so that matrix has dynamic size). // matrix with dynamic width and fixed height (so that matrix has dynamic size).
template<typename T, int _Rows> class MatrixStorage<T, Dynamic, _Rows, Dynamic> template<typename T, int _Rows> class ei_matrix_storage<T, Dynamic, _Rows, Dynamic>
{ {
T *m_data; T *m_data;
int m_cols; int m_cols;
public: public:
MatrixStorage(int size, int, int cols) : m_data(new T[size]), m_cols(cols) {} ei_matrix_storage(int size, int, int cols) : m_data(new T[size]), m_cols(cols) {}
~MatrixStorage() { delete[] m_data; } ~ei_matrix_storage() { delete[] m_data; }
static int rows(void) {return _Rows;} static int rows(void) {return _Rows;}
int cols(void) const {return m_cols;} int cols(void) const {return m_cols;}
void resize(int size, int, int cols) void resize(int size, int, int cols)
@ -160,13 +159,13 @@ template<typename T, int _Rows> class MatrixStorage<T, Dynamic, _Rows, Dynamic>
}; };
// matrix with dynamic height and fixed width (so that matrix has dynamic size). // matrix with dynamic height and fixed width (so that matrix has dynamic size).
template<typename T, int _Cols> class MatrixStorage<T, Dynamic, Dynamic, _Cols> template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Cols>
{ {
T *m_data; T *m_data;
int m_rows; int m_rows;
public: public:
MatrixStorage(int size, int rows, int) : m_data(new T[size]), m_rows(rows) {} ei_matrix_storage(int size, int rows, int) : m_data(new T[size]), m_rows(rows) {}
~MatrixStorage() { delete[] m_data; } ~ei_matrix_storage() { delete[] m_data; }
int rows(void) const {return m_rows;} int rows(void) const {return m_rows;}
static int cols(void) {return _Cols;} static int cols(void) {return _Cols;}
void resize(int size, int rows, int) void resize(int size, int rows, int)

View File

@ -58,7 +58,7 @@ template<typename MatrixType> class Minor
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Minor) EIGEN_GENERIC_PUBLIC_INTERFACE(Minor)
typedef typename MatrixType::AsArg MatRef; typedef typename MatrixType::AsArg MatRef;

View File

@ -44,12 +44,12 @@ struct ei_traits<Ones<MatrixType> >
}; };
}; };
template<typename MatrixType> class Ones : NoOperatorEquals, template<typename MatrixType> class Ones : ei_no_assignment_operator,
public MatrixBase<Ones<MatrixType> > public MatrixBase<Ones<MatrixType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Ones) EIGEN_GENERIC_PUBLIC_INTERFACE(Ones)
private: private:
@ -72,8 +72,8 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
} }
protected: protected:
const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const ei_int_if_dynamic<RowsAtCompileTime> m_rows;
const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; const ei_int_if_dynamic<ColsAtCompileTime> m_cols;
}; };
/** \returns an expression of a matrix where all coefficients equal one. /** \returns an expression of a matrix where all coefficients equal one.

View File

@ -27,7 +27,7 @@
#define EIGEN_OPERATOREQUALS_H #define EIGEN_OPERATOREQUALS_H
template<typename Derived1, typename Derived2, int UnrollCount> template<typename Derived1, typename Derived2, int UnrollCount>
struct MatrixOperatorEqualsUnroller struct ei_matrix_operator_equals_unroller
{ {
enum { enum {
col = (UnrollCount-1) / Derived1::RowsAtCompileTime, col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
@ -36,13 +36,13 @@ struct MatrixOperatorEqualsUnroller
static void run(Derived1 &dst, const Derived2 &src) static void run(Derived1 &dst, const Derived2 &src)
{ {
MatrixOperatorEqualsUnroller<Derived1, Derived2, UnrollCount-1>::run(dst, src); ei_matrix_operator_equals_unroller<Derived1, Derived2, UnrollCount-1>::run(dst, src);
dst.coeffRef(row, col) = src.coeff(row, col); dst.coeffRef(row, col) = src.coeff(row, col);
} }
}; };
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct MatrixOperatorEqualsUnroller<Derived1, Derived2, 1> struct ei_matrix_operator_equals_unroller<Derived1, Derived2, 1>
{ {
static void run(Derived1 &dst, const Derived2 &src) static void run(Derived1 &dst, const Derived2 &src)
{ {
@ -52,38 +52,38 @@ struct MatrixOperatorEqualsUnroller<Derived1, Derived2, 1>
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct MatrixOperatorEqualsUnroller<Derived1, Derived2, 0> struct ei_matrix_operator_equals_unroller<Derived1, Derived2, 0>
{ {
static void run(Derived1 &, const Derived2 &) {} static void run(Derived1 &, const Derived2 &) {}
}; };
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct MatrixOperatorEqualsUnroller<Derived1, Derived2, Dynamic> struct ei_matrix_operator_equals_unroller<Derived1, Derived2, Dynamic>
{ {
static void run(Derived1 &, const Derived2 &) {} static void run(Derived1 &, const Derived2 &) {}
}; };
template<typename Derived1, typename Derived2, int UnrollCount> template<typename Derived1, typename Derived2, int UnrollCount>
struct VectorOperatorEqualsUnroller struct ei_vector_operator_equals_unroller
{ {
enum { index = UnrollCount - 1 }; enum { index = UnrollCount - 1 };
static void run(Derived1 &dst, const Derived2 &src) static void run(Derived1 &dst, const Derived2 &src)
{ {
VectorOperatorEqualsUnroller<Derived1, Derived2, UnrollCount-1>::run(dst, src); ei_vector_operator_equals_unroller<Derived1, Derived2, UnrollCount-1>::run(dst, src);
dst.coeffRef(index) = src.coeff(index); dst.coeffRef(index) = src.coeff(index);
} }
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct VectorOperatorEqualsUnroller<Derived1, Derived2, 0> struct ei_vector_operator_equals_unroller<Derived1, Derived2, 0>
{ {
static void run(Derived1 &, const Derived2 &) {} static void run(Derived1 &, const Derived2 &) {}
}; };
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct VectorOperatorEqualsUnroller<Derived1, Derived2, 1> struct ei_vector_operator_equals_unroller<Derived1, Derived2, 1>
{ {
static void run(Derived1 &dst, const Derived2 &src) static void run(Derived1 &dst, const Derived2 &src)
{ {
@ -92,7 +92,7 @@ struct VectorOperatorEqualsUnroller<Derived1, Derived2, 1>
}; };
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct VectorOperatorEqualsUnroller<Derived1, Derived2, Dynamic> struct ei_vector_operator_equals_unroller<Derived1, Derived2, Dynamic>
{ {
static void run(Derived1 &, const Derived2 &) {} static void run(Derived1 &, const Derived2 &) {}
}; };
@ -108,10 +108,10 @@ Derived& MatrixBase<Derived>
assert(size() == other.size()); assert(size() == other.size());
if(EIGEN_UNROLLED_LOOPS if(EIGEN_UNROLLED_LOOPS
&& SizeAtCompileTime != Dynamic && SizeAtCompileTime != Dynamic
&& SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL) && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
VectorOperatorEqualsUnroller ei_vector_operator_equals_unroller
<Derived, OtherDerived, <Derived, OtherDerived,
SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL ? SizeAtCompileTime : Dynamic>::run SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic>::run
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other)); (*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
else else
for(int i = 0; i < size(); i++) for(int i = 0; i < size(); i++)
@ -123,11 +123,11 @@ Derived& MatrixBase<Derived>
assert(rows() == other.rows() && cols() == other.cols()); assert(rows() == other.rows() && cols() == other.cols());
if(EIGEN_UNROLLED_LOOPS if(EIGEN_UNROLLED_LOOPS
&& SizeAtCompileTime != Dynamic && SizeAtCompileTime != Dynamic
&& SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL) && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
{ {
MatrixOperatorEqualsUnroller ei_matrix_operator_equals_unroller
<Derived, OtherDerived, <Derived, OtherDerived,
SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL ? SizeAtCompileTime : Dynamic>::run SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic>::run
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other)); (*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
} }
else else

View File

@ -26,18 +26,18 @@
#define EIGEN_PRODUCT_H #define EIGEN_PRODUCT_H
template<int Index, int Size, typename Lhs, typename Rhs> template<int Index, int Size, typename Lhs, typename Rhs>
struct ProductUnroller struct ei_product_unroller
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
{ {
ProductUnroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res); ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res);
res += lhs.coeff(row, Index) * rhs.coeff(Index, col); res += lhs.coeff(row, Index) * rhs.coeff(Index, col);
} }
}; };
template<int Size, typename Lhs, typename Rhs> template<int Size, typename Lhs, typename Rhs>
struct ProductUnroller<0, Size, Lhs, Rhs> struct ei_product_unroller<0, Size, Lhs, Rhs>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
@ -47,14 +47,14 @@ struct ProductUnroller<0, Size, Lhs, Rhs>
}; };
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ProductUnroller<Index, Dynamic, Lhs, Rhs> struct ei_product_unroller<Index, Dynamic, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ProductUnroller<Index, 0, Lhs, Rhs> struct ei_product_unroller<Index, 0, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
@ -84,12 +84,12 @@ struct ei_traits<Product<Lhs, Rhs> >
}; };
}; };
template<typename Lhs, typename Rhs> class Product : NoOperatorEquals, template<typename Lhs, typename Rhs> class Product : ei_no_assignment_operator,
public MatrixBase<Product<Lhs, Rhs> > public MatrixBase<Product<Lhs, Rhs> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Product) EIGEN_GENERIC_PUBLIC_INTERFACE(Product)
typedef typename Lhs::AsArg LhsRef; typedef typename Lhs::AsArg LhsRef;
typedef typename Rhs::AsArg RhsRef; typedef typename Rhs::AsArg RhsRef;
@ -111,9 +111,9 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
Scalar res; Scalar res;
if(EIGEN_UNROLLED_LOOPS if(EIGEN_UNROLLED_LOOPS
&& Lhs::ColsAtCompileTime != Dynamic && Lhs::ColsAtCompileTime != Dynamic
&& Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) && Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT)
ProductUnroller<Lhs::ColsAtCompileTime-1, ei_product_unroller<Lhs::ColsAtCompileTime-1,
Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? Lhs::ColsAtCompileTime : Dynamic, Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT ? Lhs::ColsAtCompileTime : Dynamic,
LhsRef, RhsRef> LhsRef, RhsRef>
::run(row, col, m_lhs, m_rhs, res); ::run(row, col, m_lhs, m_rhs, res);
else else

View File

@ -44,12 +44,12 @@ struct ei_traits<Random<MatrixType> >
}; };
}; };
template<typename MatrixType> class Random : NoOperatorEquals, template<typename MatrixType> class Random : ei_no_assignment_operator,
public MatrixBase<Random<MatrixType> > public MatrixBase<Random<MatrixType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Random) EIGEN_GENERIC_PUBLIC_INTERFACE(Random)
const Random& _asArg() const { return *this; } const Random& _asArg() const { return *this; }
int _rows() const { return m_rows.value(); } int _rows() const { return m_rows.value(); }
@ -70,8 +70,8 @@ template<typename MatrixType> class Random : NoOperatorEquals,
} }
protected: protected:
const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const ei_int_if_dynamic<RowsAtCompileTime> m_rows;
const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; const ei_int_if_dynamic<ColsAtCompileTime> m_cols;
}; };
/** \returns a random matrix (not an expression, the matrix is immediately evaluated). /** \returns a random matrix (not an expression, the matrix is immediately evaluated).

View File

@ -25,16 +25,16 @@
#ifndef EIGEN_TRACE_H #ifndef EIGEN_TRACE_H
#define EIGEN_TRACE_H #define EIGEN_TRACE_H
template<int Index, int Rows, typename Derived> struct TraceUnroller template<int Index, int Rows, typename Derived> struct ei_trace_unroller
{ {
static void run(const Derived &mat, typename Derived::Scalar &trace) static void run(const Derived &mat, typename Derived::Scalar &trace)
{ {
TraceUnroller<Index-1, Rows, Derived>::run(mat, trace); ei_trace_unroller<Index-1, Rows, Derived>::run(mat, trace);
trace += mat.coeff(Index, Index); trace += mat.coeff(Index, Index);
} }
}; };
template<int Rows, typename Derived> struct TraceUnroller<0, Rows, Derived> template<int Rows, typename Derived> struct ei_trace_unroller<0, Rows, Derived>
{ {
static void run(const Derived &mat, typename Derived::Scalar &trace) static void run(const Derived &mat, typename Derived::Scalar &trace)
{ {
@ -42,13 +42,13 @@ template<int Rows, typename Derived> struct TraceUnroller<0, Rows, Derived>
} }
}; };
template<int Index, typename Derived> struct TraceUnroller<Index, Dynamic, Derived> template<int Index, typename Derived> struct ei_trace_unroller<Index, Dynamic, Derived>
{ {
static void run(const Derived&, typename Derived::Scalar&) {} static void run(const Derived&, typename Derived::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Derived> struct TraceUnroller<Index, 0, Derived> template<int Index, typename Derived> struct ei_trace_unroller<Index, 0, Derived>
{ {
static void run(const Derived&, typename Derived::Scalar&) {} static void run(const Derived&, typename Derived::Scalar&) {}
}; };
@ -64,9 +64,9 @@ MatrixBase<Derived>::trace() const
Scalar res; Scalar res;
if(EIGEN_UNROLLED_LOOPS if(EIGEN_UNROLLED_LOOPS
&& RowsAtCompileTime != Dynamic && RowsAtCompileTime != Dynamic
&& RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) && RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT)
TraceUnroller<RowsAtCompileTime-1, ei_trace_unroller<RowsAtCompileTime-1,
RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? RowsAtCompileTime : Dynamic, Derived> RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT ? RowsAtCompileTime : Dynamic, Derived>
::run(*static_cast<const Derived*>(this), res); ::run(*static_cast<const Derived*>(this), res);
else else
{ {

View File

@ -54,7 +54,7 @@ template<typename MatrixType> class Transpose
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Transpose) EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose)
typedef typename MatrixType::AsArg MatRef; typedef typename MatrixType::AsArg MatRef;
@ -108,9 +108,9 @@ MatrixBase<Derived>::transpose() const
* Example: \include MatrixBase_adjoint.cpp * Example: \include MatrixBase_adjoint.cpp
* Output: \verbinclude MatrixBase_adjoint.out * Output: \verbinclude MatrixBase_adjoint.out
* *
* \sa transpose(), conjugate(), class Transpose, class ScalarConjugateOp */ * \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
template<typename Derived> template<typename Derived>
const Transpose<CwiseUnaryOp<ScalarConjugateOp, Derived> > const Transpose<CwiseUnaryOp<ei_scalar_conjugate_op, Derived> >
MatrixBase<Derived>::adjoint() const MatrixBase<Derived>::adjoint() const
{ {
return conjugate().transpose(); return conjugate().transpose();

View File

@ -31,18 +31,9 @@
#define EIGEN_UNROLLED_LOOPS (true) #define EIGEN_UNROLLED_LOOPS (true)
#endif #endif
/** Defines the maximal loop size (i.e., the matrix size NxM) to enable /** Defines the maximal loop size to enable meta unrolling of loops */
* meta unrolling of operator=. #ifndef EIGEN_UNROLLING_LIMIT
*/ #define EIGEN_UNROLLING_LIMIT 16
#ifndef EIGEN_UNROLLING_LIMIT_OPEQUAL
#define EIGEN_UNROLLING_LIMIT_OPEQUAL 25
#endif
/** Defines the maximal loop size to enable meta unrolling
* of the matrix product, dot product and trace.
*/
#ifndef EIGEN_UNROLLING_LIMIT_PRODUCT
#define EIGEN_UNROLLING_LIMIT_PRODUCT 16
#endif #endif
#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
@ -105,20 +96,20 @@ EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=) EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
#define _EIGEN_BASIC_PUBLIC_INTERFACE(Derived, BaseClass) \ #define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \
friend class MatrixBase<Derived>; \
typedef BaseClass Base; \ typedef BaseClass Base; \
typedef typename ei_traits<Derived>::Scalar Scalar; \ typedef typename ei_traits<Derived>::Scalar Scalar; \
enum { RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime, \ using Base::RowsAtCompileTime; \
ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime, \ using Base::ColsAtCompileTime; \
MaxRowsAtCompileTime = ei_traits<Derived>::MaxRowsAtCompileTime, \ using Base::MaxRowsAtCompileTime; \
MaxColsAtCompileTime = ei_traits<Derived>::MaxColsAtCompileTime }; \ using Base::MaxColsAtCompileTime; \
using Base::SizeAtCompileTime; \ using Base::SizeAtCompileTime; \
using Base::MaxSizeAtCompileTime; \ using Base::MaxSizeAtCompileTime; \
using Base::IsVectorAtCompileTime; using Base::IsVectorAtCompileTime;
#define EIGEN_BASIC_PUBLIC_INTERFACE(Derived) \ #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
_EIGEN_BASIC_PUBLIC_INTERFACE(Derived, MatrixBase<Derived>) _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, MatrixBase<Derived>) \
friend class MatrixBase<Derived>;
#define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b) #define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
@ -130,34 +121,34 @@ enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight };
// just a workaround because GCC seems to not really like empty structs // just a workaround because GCC seems to not really like empty structs
#ifdef __GNUG__ #ifdef __GNUG__
struct EiEmptyStruct{char _ei_dummy_;}; struct ei_empty_struct{char _ei_dummy_;};
#define EIGEN_EMPTY_STRUCT : Eigen::EiEmptyStruct #define EIGEN_EMPTY_STRUCT : Eigen::ei_empty_struct
#else #else
#define EIGEN_EMPTY_STRUCT #define EIGEN_EMPTY_STRUCT
#endif #endif
//classes inheriting NoOperatorEquals don't generate a default operator=. //classes inheriting ei_no_assignment_operator don't generate a default operator=.
class NoOperatorEquals class ei_no_assignment_operator
{ {
private: private:
NoOperatorEquals& operator=(const NoOperatorEquals&); ei_no_assignment_operator& operator=(const ei_no_assignment_operator&);
}; };
template<int Value> class IntAtRunTimeIfDynamic EIGEN_EMPTY_STRUCT template<int Value> class ei_int_if_dynamic EIGEN_EMPTY_STRUCT
{ {
public: public:
IntAtRunTimeIfDynamic() {} ei_int_if_dynamic() {}
explicit IntAtRunTimeIfDynamic(int) {} explicit ei_int_if_dynamic(int) {}
static int value() { return Value; } static int value() { return Value; }
void setValue(int) {} void setValue(int) {}
}; };
template<> class IntAtRunTimeIfDynamic<Dynamic> template<> class ei_int_if_dynamic<Dynamic>
{ {
int m_value; int m_value;
IntAtRunTimeIfDynamic() {} ei_int_if_dynamic() {}
public: public:
explicit IntAtRunTimeIfDynamic(int value) : m_value(value) {} explicit ei_int_if_dynamic(int value) : m_value(value) {}
int value() const { return m_value; } int value() const { return m_value; }
void setValue(int value) { m_value = value; } void setValue(int value) { m_value = value; }
}; };

View File

@ -44,12 +44,12 @@ struct ei_traits<Zero<MatrixType> >
}; };
}; };
template<typename MatrixType> class Zero : NoOperatorEquals, template<typename MatrixType> class Zero : ei_no_assignment_operator,
public MatrixBase<Zero<MatrixType> > public MatrixBase<Zero<MatrixType> >
{ {
public: public:
EIGEN_BASIC_PUBLIC_INTERFACE(Zero) EIGEN_GENERIC_PUBLIC_INTERFACE(Zero)
private: private:
@ -73,8 +73,8 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
} }
protected: protected:
const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const ei_int_if_dynamic<RowsAtCompileTime> m_rows;
const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; const ei_int_if_dynamic<ColsAtCompileTime> m_cols;
}; };
/** \returns an expression of a zero matrix. /** \returns an expression of a zero matrix.

View File

@ -5,7 +5,7 @@
for ((i=1; i<16; ++i)); do for ((i=1; i<16; ++i)); do
echo "Matrix size: $i x $i :" echo "Matrix size: $i x $i :"
$CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT_OPEQUAL=1024 -DEIGEN_UNROLLING_LIMIT_PRODUCT=25 -o benchmark && time ./benchmark >/dev/null $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=1024 -DEIGEN_UNROLLING_LIMIT=25 -o benchmark && time ./benchmark >/dev/null
$CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null
echo " " echo " "
done done

View File

@ -4,14 +4,14 @@ using namespace std;
template<typename Derived> template<typename Derived>
const Eigen::CwiseUnaryOp< const Eigen::CwiseUnaryOp<
Eigen::ScalarCastOp< Eigen::ei_scalar_cast_op<
typename Eigen::NumTraits<typename Derived::Scalar>::FloatingPoint typename Eigen::ei_traits<typename Derived::Scalar>::FloatingPoint
>, Derived >, Derived
> >
castToFloatingPoint(const MatrixBase<Derived>& m) castToFloatingPoint(const MatrixBase<Derived>& m)
{ {
return m.template cast< return m.template cast<
typename Eigen::NumTraits< typename Eigen::ei_traits<
typename Derived::Scalar typename Derived::Scalar
>::FloatingPoint >::FloatingPoint
>(); >();

View File

@ -28,7 +28,7 @@ namespace Eigen {
// check minor separately in order to avoid the possible creation of a zero-sized // check minor separately in order to avoid the possible creation of a zero-sized
// array. Comes from a compilation error with gcc-3.4 or gcc-4 with -ansi -pedantic. // array. Comes from a compilation error with gcc-3.4 or gcc-4 with -ansi -pedantic.
// Another solution would be to declare the array like this: T m_data[Size==0?1:Size]; in MatrixStorage // Another solution would be to declare the array like this: T m_data[Size==0?1:Size]; in ei_matrix_storage
// but this is probably not bad to raise such an error at compile time... // but this is probably not bad to raise such an error at compile time...
template<typename Scalar, int _Rows, int _Cols> struct CheckMinor template<typename Scalar, int _Rows, int _Cols> struct CheckMinor
{ {