lot of cleaning:

- clean the *_PUBLIC_INTERFACE_*
- update Diagonal, ReturnByValue, ForceAlignedAccess, UnaryView, etc. to support array
- many other small stuff
This commit is contained in:
Gael Guennebaud
2010-01-22 10:15:41 +01:00
parent f1a025185a
commit d40c110053
33 changed files with 140 additions and 259 deletions

View File

@@ -86,7 +86,7 @@ template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessSta
public:
typedef typename MatrixType::template MakeBase< Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE(Block)
EIGEN_DENSE_PUBLIC_INTERFACE(Block)
class InnerIterator;
@@ -218,7 +218,7 @@ class Block<MatrixType,BlockRows,BlockCols,HasDirectAccess>
public:
typedef MapBase<Block, typename MatrixType::template MakeBase<Block>::Type> Base;
_EIGEN_GENERIC_PUBLIC_INTERFACE(Block)
EIGEN_DENSE_PUBLIC_INTERFACE(Block)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)

View File

@@ -124,8 +124,11 @@ class CwiseBinaryOp : ei_no_assignment_operator,
EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
/** \returns the left hand side nested expression */
const _LhsNested& lhs() const { return m_lhs; }
/** \returns the right hand side nested expression */
const _RhsNested& rhs() const { return m_rhs; }
/** \returns the functor representing the binary operation */
const BinaryOp& functor() const { return m_functor; }
protected:
@@ -138,11 +141,11 @@ template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
: public Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type
{
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
public:
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
typedef typename Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
{

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -60,7 +60,7 @@ class CwiseNullaryOp : ei_no_assignment_operator,
public:
typedef typename MatrixType::template MakeBase< CwiseNullaryOp<NullaryOp, MatrixType> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
CwiseNullaryOp(int rows, int cols, const NullaryOp& func = NullaryOp())
: m_rows(rows), m_cols(cols), m_functor(func)

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -74,16 +74,14 @@ class CwiseUnaryOp : ei_no_assignment_operator,
EIGEN_STRONG_INLINE int rows() const { return m_matrix.rows(); }
EIGEN_STRONG_INLINE int cols() const { return m_matrix.cols(); }
/** \internal used for introspection */
const UnaryOp& _functor() const { return m_functor; }
/** \internal used for introspection */
const typename ei_cleantype<typename MatrixType::Nested>::type&
_expression() const { return m_matrix; }
/** \returns the functor representing the unary operation */
const UnaryOp& functor() const { return m_functor; }
/** \returns the nested expression */
const typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() const { return m_matrix; }
/** \returns the nested expression */
typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() { return m_matrix.const_cast_derived(); }
@@ -98,37 +96,33 @@ template<typename UnaryOp, typename MatrixType>
class CwiseUnaryOpImpl<UnaryOp,MatrixType,Dense>
: public MatrixType::template MakeBase< CwiseUnaryOp<UnaryOp, MatrixType> >::Type
{
const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const
{ return derived().nestedExpression(); }
typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression()
{ return derived().nestedExpression(); }
typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
public:
typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
typedef typename MatrixType::template MakeBase< CwiseUnaryOp<UnaryOp, MatrixType> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
{
return derived()._functor()(nestedExpression().coeff(row, col));
return derived().functor()(derived().nestedExpression().coeff(row, col));
}
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet(int row, int col) const
{
return derived()._functor().packetOp(nestedExpression().template packet<LoadMode>(row, col));
return derived().functor().packetOp(derived().nestedExpression().template packet<LoadMode>(row, col));
}
EIGEN_STRONG_INLINE const Scalar coeff(int index) const
{
return derived()._functor()(nestedExpression().coeff(index));
return derived().functor()(derived().nestedExpression().coeff(index));
}
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet(int index) const
{
return derived()._functor().packetOp(nestedExpression().template packet<LoadMode>(index));
return derived().functor().packetOp(derived().nestedExpression().template packet<LoadMode>(index));
}
};

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -72,12 +72,14 @@ class CwiseUnaryView : ei_no_assignment_operator,
EIGEN_STRONG_INLINE int rows() const { return m_matrix.rows(); }
EIGEN_STRONG_INLINE int cols() const { return m_matrix.cols(); }
/** \internal used for introspection */
const ViewOp& _functor() const { return m_functor; }
/** \returns the functor representing unary operation */
const ViewOp& functor() const { return m_functor; }
/** \returns the nested expression */
const typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() const { return m_matrix; }
/** \returns the nested expression */
typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() { return m_matrix.const_cast_derived(); }
@@ -88,36 +90,34 @@ class CwiseUnaryView : ei_no_assignment_operator,
};
template<typename ViewOp, typename MatrixType>
class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense> : public MatrixBase<CwiseUnaryView<ViewOp, MatrixType> >
class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
: public MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type
{
const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const
{ return derived().nestedExpression(); }
typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression()
{ return derived().nestedExpression(); }
typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
public:
typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
typedef typename MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
{
return derived()._functor()(nestedExpression().coeff(row, col));
return derived().functor()(derived().nestedExpression().coeff(row, col));
}
EIGEN_STRONG_INLINE const Scalar coeff(int index) const
{
return derived()._functor()(nestedExpression().coeff(index));
return derived().functor()(derived().nestedExpression().coeff(index));
}
EIGEN_STRONG_INLINE Scalar& coeffRef(int row, int col)
{
return derived()._functor()(nestedExpression().const_cast_derived().coeffRef(row, col));
return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col));
}
EIGEN_STRONG_INLINE Scalar& coeffRef(int index)
{
return derived()._functor()(nestedExpression().const_cast_derived().coeffRef(index));
return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index));
}
};

View File

@@ -2,7 +2,7 @@
// for linear algebra.
//
// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@@ -64,7 +64,7 @@ struct ei_traits<Diagonal<MatrixType,Index> >
};
template<typename MatrixType, int Index> class Diagonal
: public MatrixBase<Diagonal<MatrixType, Index> >
: public MatrixType::template MakeBase< Diagonal<MatrixType,Index> >::Type
{
// some compilers may fail to optimize std::max etc in case of compile-time constants...
EIGEN_STRONG_INLINE int absIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); }
@@ -73,7 +73,8 @@ template<typename MatrixType, int Index> class Diagonal
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(Diagonal)
typedef typename MatrixType::template MakeBase<Diagonal>::Type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal)
inline Diagonal(const MatrixType& matrix, int index = Index) : m_matrix(matrix), m_index(index) {}

View File

@@ -48,7 +48,8 @@ class DiagonalProduct : ei_no_assignment_operator,
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalProduct)
typedef MatrixBase<DiagonalProduct> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct)
inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal)
: m_matrix(matrix), m_diagonal(diagonal)

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -41,11 +41,12 @@ struct ei_traits<ForceAlignedAccess<ExpressionType> > : public ei_traits<Express
{};
template<typename ExpressionType> class ForceAlignedAccess
: public MatrixBase<ForceAlignedAccess<ExpressionType> >
: public ExpressionType::template MakeBase< ForceAlignedAccess<ExpressionType> >::Type
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(ForceAlignedAccess)
typedef typename ExpressionType::template MakeBase<ForceAlignedAccess<ExpressionType> >::Type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}

View File

@@ -64,7 +64,7 @@ template<typename MatrixType, int Options> class Map
public:
typedef MapBase<Map,typename MatrixType::template MakeBase<Map>::Type> Base;
_EIGEN_GENERIC_PUBLIC_INTERFACE(Map)
EIGEN_DENSE_PUBLIC_INTERFACE(Map)
inline int stride() const { return this->innerSize(); }

View File

@@ -134,10 +134,10 @@ class Matrix
* \sa DenseStorageBase
*/
typedef DenseStorageBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Eigen::MatrixBase, _Options> Base;
enum { Options = _Options };
_EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix)
EIGEN_DENSE_PUBLIC_INTERFACE(Matrix)
typedef typename Base::PlainMatrixType PlainMatrixType;
@@ -297,7 +297,7 @@ class Matrix
}
/** \brief Copy constructor for generic expressions.
* \sa MatrixBase::operator=(const AnyMatrixBase<OtherDerived>&)
* \sa MatrixBase::operator=(const AnyMatrixBase<OtherDerived>&)
*/
template<typename OtherDerived>
EIGEN_STRONG_INLINE Matrix(const AnyMatrixBase<OtherDerived> &other)
@@ -311,7 +311,7 @@ class Matrix
}
/** \internal
* \brief Override MatrixBase::swap() since for dynamic-sized matrices
* \brief Override MatrixBase::swap() since for dynamic-sized matrices
* of same type it is enough to swap the data pointers.
*/
template<typename OtherDerived>

View File

@@ -64,7 +64,8 @@ template<typename MatrixType> class Minor
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(Minor)
typedef MatrixBase<Minor> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Minor)
inline Minor(const MatrixType& matrix,
int row, int col)

View File

@@ -42,11 +42,12 @@ struct ei_traits<NestByValue<ExpressionType> > : public ei_traits<ExpressionType
{};
template<typename ExpressionType> class NestByValue
: public MatrixBase<NestByValue<ExpressionType> >
: public ExpressionType::template MakeBase< NestByValue<ExpressionType> >::Type
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(NestByValue)
typedef typename ExpressionType::template MakeBase<NestByValue<ExpressionType> >::Type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
@@ -97,7 +98,7 @@ template<typename ExpressionType> class NestByValue
{
m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
}
operator const ExpressionType&() const { return m_expression; }
protected:

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -56,7 +56,7 @@ struct ei_nested<ProductBase<Derived,Lhs,Rhs>, N, EvalType>
#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \
typedef ProductBase<Derived, Lhs, Rhs > Base; \
_EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
typedef typename Base::LhsNested LhsNested; \
typedef typename Base::_LhsNested _LhsNested; \
typedef typename Base::LhsBlasTraits LhsBlasTraits; \
@@ -75,7 +75,7 @@ class ProductBase : public MatrixBase<Derived>
{
public:
typedef MatrixBase<Derived> Base;
_EIGEN_GENERIC_PUBLIC_INTERFACE(ProductBase)
EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase)
typedef typename Lhs::Nested LhsNested;
typedef typename ei_cleantype<LhsNested>::type _LhsNested;
@@ -89,7 +89,6 @@ class ProductBase : public MatrixBase<Derived>
typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
typedef typename ei_cleantype<ActualRhsType>::type _ActualRhsType;
using Base::derived;
typedef typename Base::PlainMatrixType PlainMatrixType;
ProductBase(const Lhs& lhs, const Rhs& rhs)

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -57,12 +57,14 @@ struct ei_nested<ReturnByValue<Derived>, n, PlainMatrixType>
typedef typename ei_traits<Derived>::ReturnMatrixType type;
};
template<typename Derived>
class ReturnByValue : public MatrixBase<ReturnByValue<Derived> >
template<typename Derived> class ReturnByValue
: public ei_traits<Derived>::ReturnMatrixType::template MakeBase<ReturnByValue<Derived> >::Type
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(ReturnByValue)
typedef typename ei_traits<Derived>::ReturnMatrixType ReturnMatrixType;
typedef typename ReturnMatrixType::template MakeBase<ReturnByValue<Derived> >::Type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
template<typename Dest>
inline void evalTo(Dest& dst) const
{ static_cast<const Derived* const>(this)->evalTo(dst); }

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
public:
typedef typename MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
typedef typename ei_packet_traits<Scalar>::type Packet;

View File

@@ -40,7 +40,7 @@ template<typename ExpressionType> class SwapWrapper
public:
typedef typename ExpressionType::template MakeBase<SwapWrapper<ExpressionType> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper)
EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper)
typedef typename ei_packet_traits<Scalar>::type Packet;
inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {}

View File

@@ -2,6 +2,7 @@
// for linear algebra.
//
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -71,13 +72,11 @@ template<typename MatrixType> class Transpose
inline int rows() const { return m_matrix.cols(); }
inline int cols() const { return m_matrix.rows(); }
/** \internal used for introspection */
const typename ei_cleantype<typename MatrixType::Nested>::type&
_expression() const { return m_matrix; }
/** \returns the nested expression */
const typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() const { return m_matrix; }
/** \returns the nested expression */
typename ei_cleantype<typename MatrixType::Nested>::type&
nestedExpression() { return m_matrix.const_cast_derived(); }
@@ -89,65 +88,57 @@ template<typename MatrixType> class Transpose
template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
: public MatrixType::template MakeBase<Transpose<MatrixType> >::Type
{
const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const
{ return derived().nestedExpression(); }
typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression()
{ return derived().nestedExpression(); }
public:
//EIGEN_DENSE_PUBLpename IC_INTERFACE(TransposeImpl,MatrixBase<Transpose<MatrixType> >)
typedef typename MatrixType::template MakeBase<Transpose<MatrixType> >::Type Base;
_EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
// EIGEN_EXPRESSION_IMPL_COMMON(MatrixBase<Transpose<MatrixType> >)
inline int stride() const { return nestedExpression().stride(); }
inline Scalar* data() { return nestedExpression().data(); }
inline const Scalar* data() const { return nestedExpression().data(); }
inline int stride() const { return derived().nestedExpression().stride(); }
inline Scalar* data() { return derived().nestedExpression().data(); }
inline const Scalar* data() const { return derived().nestedExpression().data(); }
inline Scalar& coeffRef(int row, int col)
{
return nestedExpression().const_cast_derived().coeffRef(col, row);
return const_cast_derived().nestedExpression().coeffRef(col, row);
}
inline Scalar& coeffRef(int index)
{
return nestedExpression().const_cast_derived().coeffRef(index);
return const_cast_derived().nestedExpression().coeffRef(index);
}
inline const CoeffReturnType coeff(int row, int col) const
{
return nestedExpression().coeff(col, row);
return derived().nestedExpression().coeff(col, row);
}
inline const CoeffReturnType coeff(int index) const
{
return nestedExpression().coeff(index);
return derived().nestedExpression().coeff(index);
}
template<int LoadMode>
inline const PacketScalar packet(int row, int col) const
{
return nestedExpression().template packet<LoadMode>(col, row);
return derived().nestedExpression().template packet<LoadMode>(col, row);
}
template<int LoadMode>
inline void writePacket(int row, int col, const PacketScalar& x)
{
nestedExpression().const_cast_derived().template writePacket<LoadMode>(col, row, x);
const_cast_derived().nestedExpression().template writePacket<LoadMode>(col, row, x);
}
template<int LoadMode>
inline const PacketScalar packet(int index) const
{
return nestedExpression().template packet<LoadMode>(index);
return derived().nestedExpression().template packet<LoadMode>(index);
}
template<int LoadMode>
inline void writePacket(int index, const PacketScalar& x)
{
nestedExpression().const_cast_derived().template writePacket<LoadMode>(index, x);
const_cast_derived().nestedExpression().template writePacket<LoadMode>(index, x);
}
};

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -75,7 +75,7 @@ template<typename VectorType, int Size> class VectorBlock
IsColVector = ei_traits<VectorType>::ColsAtCompileTime==1
};
public:
_EIGEN_GENERIC_PUBLIC_INTERFACE(VectorBlock)
EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
using Base::operator=;

View File

@@ -2,7 +2,7 @@
// for linear algebra.
//
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -104,7 +104,8 @@ template<typename LhsNested, typename RhsNested> class GeneralProduct<LhsNested,
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(GeneralProduct)
typedef MatrixBase<GeneralProduct> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(GeneralProduct)
private:

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -185,8 +185,8 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestedXpr> >
IsComplex = NumTraits<Scalar>::IsComplex,
NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
};
static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return ei_conj(Base::extractScalarFactor(x._expression())); }
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return ei_conj(Base::extractScalarFactor(x.nestedExpression())); }
};
// pop scalar multiple
@@ -197,9 +197,9 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> >
typedef ei_blas_traits<NestedXpr> Base;
typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType;
static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); }
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x)
{ return x._functor().m_other * Base::extractScalarFactor(x._expression()); }
{ return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); }
};
// pop opposite
@@ -210,9 +210,9 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> >
typedef ei_blas_traits<NestedXpr> Base;
typedef CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType;
static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); }
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x)
{ return - Base::extractScalarFactor(x._expression()); }
{ return - Base::extractScalarFactor(x.nestedExpression()); }
};
// pop/push transpose
@@ -232,8 +232,8 @@ struct ei_blas_traits<Transpose<NestedXpr> >
enum {
IsTransposed = Base::IsTransposed ? 0 : 1
};
static inline const ExtractType extract(const XprType& x) { return Base::extract(x._expression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x._expression()); }
static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
};
#endif // EIGEN_BLASUTIL_H

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -281,50 +281,30 @@ using Eigen::ei_cos;
* Just a side note. Commenting within defines works only by documenting
* behind the object (via '!<'). Comments cannot be multi-line and thus
* we have these extra long lines. What is confusing doxygen over here is
* that we use '\' and basically have a bunch of typedefs with their
* that we use '\' and basically have a bunch of typedefs with their
* documentation in a single line.
**/
#define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
#define EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Derived) \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \
typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \
typedef typename Eigen::ei_nested<Derived>::type Nested; \
enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
Flags = Eigen::ei_traits<Derived>::Flags, \
CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \
typedef typename Base::PacketScalar PacketScalar; \
typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \
typedef typename Eigen::ei_nested<Derived>::type Nested; \
enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
MaxRowsAtCompileTime = Eigen::ei_traits<Derived>::MaxRowsAtCompileTime, \
MaxColsAtCompileTime = Eigen::ei_traits<Derived>::MaxColsAtCompileTime, \
Flags = Eigen::ei_traits<Derived>::Flags, \
CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
typedef Eigen::MatrixBase<Derived> Base; \
_EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
#define EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Derived) \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
typedef typename Base::CoeffReturnType CoeffReturnType; \
typedef typename Eigen::ei_nested<Derived>::type Nested; \
enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
Flags = Eigen::ei_traits<Derived>::Flags, \
CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
#define _EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
typedef typename Base::PacketScalar PacketScalar; \
typedef typename Base::CoeffReturnType CoeffReturnType; \
typedef typename Eigen::ei_nested<Derived>::type Nested; \
enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
MaxRowsAtCompileTime = Eigen::ei_traits<Derived>::MaxRowsAtCompileTime, \
@@ -334,11 +314,8 @@ using Eigen::ei_cos;
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
using Base::derived;
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
typedef Eigen::MatrixBase<Derived> Base; \
_EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
using Base::derived; \
using Base::const_cast_derived;
#define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)