aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/Assign.h15
-rw-r--r--Eigen/src/Core/Block.h44
-rw-r--r--Eigen/src/Core/Coeffs.h36
-rw-r--r--Eigen/src/Core/CommaInitializer.h8
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h3
-rw-r--r--Eigen/src/Core/CwiseNullaryOp.h80
-rw-r--r--Eigen/src/Core/CwiseUnaryOp.h3
-rw-r--r--Eigen/src/Core/DenseBase.h517
-rw-r--r--Eigen/src/Core/Fuzzy.h28
-rw-r--r--Eigen/src/Core/IO.h10
-rw-r--r--Eigen/src/Core/Map.h6
-rw-r--r--Eigen/src/Core/MapBase.h6
-rw-r--r--Eigen/src/Core/MatrixBase.h213
-rw-r--r--Eigen/src/Core/ProductBase.h7
-rw-r--r--Eigen/src/Core/Redux.h14
-rw-r--r--Eigen/src/Core/StableNorm.h4
-rw-r--r--Eigen/src/Core/Transpose.h39
-rw-r--r--Eigen/src/Core/VectorBlock.h32
-rw-r--r--Eigen/src/Core/Visitor.h24
-rw-r--r--Eigen/src/Core/util/ForwardDeclarations.h1
-rw-r--r--Eigen/src/Core/util/Macros.h21
-rw-r--r--Eigen/src/Core/util/XprHelper.h1
22 files changed, 748 insertions, 364 deletions
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h
index 8dc015715..466205208 100644
--- a/Eigen/src/Core/Assign.h
+++ b/Eigen/src/Core/Assign.h
@@ -414,13 +414,13 @@ struct ei_assign_impl<Derived1, Derived2, SliceVectorization, NoUnrolling>
};
/***************************************************************************
-* Part 4 : implementation of MatrixBase methods
+* Part 4 : implementation of DenseBase methods
***************************************************************************/
template<typename Derived>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>
- ::lazyAssign(const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
+ ::lazyAssign(const DenseBase<OtherDerived>& other)
{
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
EIGEN_STATIC_ASSERT((ei_is_same_type<typename Derived::Scalar, typename OtherDerived::Scalar>::ret),
@@ -463,16 +463,21 @@ struct ei_assign_selector<Derived,OtherDerived,true,true> {
template<typename Derived>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
{
return ei_assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
}
template<typename Derived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
{
return ei_assign_selector<Derived,Derived>::run(derived(), other.derived());
}
+template<typename Derived>
+EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
+{
+ return ei_assign_selector<Derived,Derived>::run(derived(), other.derived());
+}
#endif // EIGEN_ASSIGN_H
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index ef2d791c9..598d846ea 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -36,7 +36,7 @@
* \param _DirectAccessStatus \internal used for partial specialization
*
* This class represents an expression of either a fixed-size or dynamic-size block. It is the return
- * type of MatrixBase::block(int,int,int,int) and MatrixBase::block<int,int>(int,int) and
+ * type of DenseBase::block(int,int,int,int) and DenseBase::block<int,int>(int,int) and
* most of the time this is the only way it is used.
*
* However, if you want to directly maniputate block expressions,
@@ -55,7 +55,7 @@
* \include class_FixedBlock.cpp
* Output: \verbinclude class_FixedBlock.out
*
- * \sa MatrixBase::block(int,int,int,int), MatrixBase::block(int,int), class VectorBlock
+ * \sa DenseBase::block(int,int,int,int), DenseBase::block(int,int), class VectorBlock
*/
template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessStatus>
struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >
@@ -83,7 +83,7 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >
};
template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessStatus> class Block
- : public MatrixBase<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >
+ :public MatrixType::template MakeBase< Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >::Type
{
public:
@@ -213,11 +213,13 @@ template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessSta
/** \internal */
template<typename MatrixType, int BlockRows, int BlockCols>
class Block<MatrixType,BlockRows,BlockCols,HasDirectAccess>
- : public MapBase<Block<MatrixType, BlockRows, BlockCols,HasDirectAccess> >
+ : public MapBase<Block<MatrixType, BlockRows, BlockCols,HasDirectAccess>,
+ typename MatrixType::template MakeBase< Block<MatrixType, BlockRows, BlockCols,HasDirectAccess> >::Type>
{
public:
- _EIGEN_GENERIC_PUBLIC_INTERFACE(Block, MapBase<Block>)
+ typedef MapBase<Block, typename MatrixType::template MakeBase<Block>::Type> Base;
+ _EIGEN_GENERIC_PUBLIC_INTERFACE(Block)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
@@ -301,7 +303,7 @@ class Block<MatrixType,BlockRows,BlockCols,HasDirectAccess>
* \sa class Block, block(int,int)
*/
template<typename Derived>
-inline typename BlockReturnType<Derived>::Type MatrixBase<Derived>
+inline typename BlockReturnType<Derived>::Type DenseBase<Derived>
::block(int startRow, int startCol, int blockRows, int blockCols)
{
return typename BlockReturnType<Derived>::Type(derived(), startRow, startCol, blockRows, blockCols);
@@ -309,7 +311,7 @@ inline typename BlockReturnType<Derived>::Type MatrixBase<Derived>
/** This is the const version of block(int,int,int,int). */
template<typename Derived>
-inline const typename BlockReturnType<Derived>::Type MatrixBase<Derived>
+inline const typename BlockReturnType<Derived>::Type DenseBase<Derived>
::block(int startRow, int startCol, int blockRows, int blockCols) const
{
return typename BlockReturnType<Derived>::Type(derived(), startRow, startCol, blockRows, blockCols);
@@ -332,7 +334,7 @@ inline const typename BlockReturnType<Derived>::Type MatrixBase<Derived>
* \sa class Block, block(int,int,int,int)
*/
template<typename Derived>
-inline typename BlockReturnType<Derived>::Type MatrixBase<Derived>
+inline typename BlockReturnType<Derived>::Type DenseBase<Derived>
::corner(CornerType type, int cRows, int cCols)
{
switch(type)
@@ -353,7 +355,7 @@ inline typename BlockReturnType<Derived>::Type MatrixBase<Derived>
/** This is the const version of corner(CornerType, int, int).*/
template<typename Derived>
inline const typename BlockReturnType<Derived>::Type
-MatrixBase<Derived>::corner(CornerType type, int cRows, int cCols) const
+DenseBase<Derived>::corner(CornerType type, int cRows, int cCols) const
{
switch(type)
{
@@ -385,7 +387,7 @@ MatrixBase<Derived>::corner(CornerType type, int cRows, int cCols) const
template<typename Derived>
template<int CRows, int CCols>
inline typename BlockReturnType<Derived, CRows, CCols>::Type
-MatrixBase<Derived>::corner(CornerType type)
+DenseBase<Derived>::corner(CornerType type)
{
switch(type)
{
@@ -406,7 +408,7 @@ MatrixBase<Derived>::corner(CornerType type)
template<typename Derived>
template<int CRows, int CCols>
inline const typename BlockReturnType<Derived, CRows, CCols>::Type
-MatrixBase<Derived>::corner(CornerType type) const
+DenseBase<Derived>::corner(CornerType type) const
{
switch(type)
{
@@ -442,7 +444,7 @@ MatrixBase<Derived>::corner(CornerType type) const
template<typename Derived>
template<int BlockRows, int BlockCols>
inline typename BlockReturnType<Derived, BlockRows, BlockCols>::Type
-MatrixBase<Derived>::block(int startRow, int startCol)
+DenseBase<Derived>::block(int startRow, int startCol)
{
return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
}
@@ -451,7 +453,7 @@ MatrixBase<Derived>::block(int startRow, int startCol)
template<typename Derived>
template<int BlockRows, int BlockCols>
inline const typename BlockReturnType<Derived, BlockRows, BlockCols>::Type
-MatrixBase<Derived>::block(int startRow, int startCol) const
+DenseBase<Derived>::block(int startRow, int startCol) const
{
return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
}
@@ -463,16 +465,16 @@ MatrixBase<Derived>::block(int startRow, int startCol) const
*
* \sa row(), class Block */
template<typename Derived>
-inline typename MatrixBase<Derived>::ColXpr
-MatrixBase<Derived>::col(int i)
+inline typename DenseBase<Derived>::ColXpr
+DenseBase<Derived>::col(int i)
{
return ColXpr(derived(), i);
}
/** This is the const version of col(). */
template<typename Derived>
-inline const typename MatrixBase<Derived>::ColXpr
-MatrixBase<Derived>::col(int i) const
+inline const typename DenseBase<Derived>::ColXpr
+DenseBase<Derived>::col(int i) const
{
return ColXpr(derived(), i);
}
@@ -484,16 +486,16 @@ MatrixBase<Derived>::col(int i) const
*
* \sa col(), class Block */
template<typename Derived>
-inline typename MatrixBase<Derived>::RowXpr
-MatrixBase<Derived>::row(int i)
+inline typename DenseBase<Derived>::RowXpr
+DenseBase<Derived>::row(int i)
{
return RowXpr(derived(), i);
}
/** This is the const version of row(). */
template<typename Derived>
-inline const typename MatrixBase<Derived>::RowXpr
-MatrixBase<Derived>::row(int i) const
+inline const typename DenseBase<Derived>::RowXpr
+DenseBase<Derived>::row(int i) const
{
return RowXpr(derived(), i);
}
diff --git a/Eigen/src/Core/Coeffs.h b/Eigen/src/Core/Coeffs.h
index 2618f0dce..c8bc9db85 100644
--- a/Eigen/src/Core/Coeffs.h
+++ b/Eigen/src/Core/Coeffs.h
@@ -40,7 +40,7 @@
* \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived>
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::CoeffReturnType DenseBase<Derived>
::coeff(int row, int col) const
{
ei_internal_assert(row >= 0 && row < rows()
@@ -53,7 +53,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBa
* \sa operator()(int,int), operator[](int) const
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived>
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::CoeffReturnType DenseBase<Derived>
::operator()(int row, int col) const
{
ei_assert(row >= 0 && row < rows()
@@ -76,7 +76,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBa
* \sa operator()(int,int), coeff(int, int) const, coeffRef(int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
+EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& DenseBase<Derived>
::coeffRef(int row, int col)
{
ei_internal_assert(row >= 0 && row < rows()
@@ -89,7 +89,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator()(int,int) const, operator[](int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
+EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& DenseBase<Derived>
::operator()(int row, int col)
{
ei_assert(row >= 0 && row < rows()
@@ -112,7 +112,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator[](int) const, coeffRef(int), coeff(int,int) const
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived>
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::CoeffReturnType DenseBase<Derived>
::coeff(int index) const
{
ei_internal_assert(index >= 0 && index < size());
@@ -127,7 +127,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBa
* z() const, w() const
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived>
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::CoeffReturnType DenseBase<Derived>
::operator[](int index) const
{
ei_assert(index >= 0 && index < size());
@@ -144,7 +144,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBa
* z() const, w() const
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived>
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::CoeffReturnType DenseBase<Derived>
::operator()(int index) const
{
ei_assert(index >= 0 && index < size());
@@ -166,7 +166,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBa
* \sa operator[](int), coeff(int) const, coeffRef(int,int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
+EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& DenseBase<Derived>
::coeffRef(int index)
{
ei_internal_assert(index >= 0 && index < size());
@@ -180,7 +180,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator[](int) const, operator()(int,int), x(), y(), z(), w()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
+EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& DenseBase<Derived>
::operator[](int index)
{
ei_assert(index >= 0 && index < size());
@@ -196,7 +196,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator[](int) const, operator()(int,int), x(), y(), z(), w()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
+EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& DenseBase<Derived>
::operator()(int index)
{
ei_assert(index >= 0 && index < size());
@@ -254,7 +254,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
template<typename Derived>
template<int LoadMode>
EIGEN_STRONG_INLINE typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type
-MatrixBase<Derived>::packet(int row, int col) const
+DenseBase<Derived>::packet(int row, int col) const
{
ei_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
@@ -271,7 +271,7 @@ MatrixBase<Derived>::packet(int row, int col) const
*/
template<typename Derived>
template<int StoreMode>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
+EIGEN_STRONG_INLINE void DenseBase<Derived>::writePacket
(int row, int col, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x)
{
ei_internal_assert(row >= 0 && row < rows()
@@ -290,7 +290,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
template<typename Derived>
template<int LoadMode>
EIGEN_STRONG_INLINE typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type
-MatrixBase<Derived>::packet(int index) const
+DenseBase<Derived>::packet(int index) const
{
ei_internal_assert(index >= 0 && index < size());
return derived().template packet<LoadMode>(index);
@@ -306,7 +306,7 @@ MatrixBase<Derived>::packet(int index) const
*/
template<typename Derived>
template<int StoreMode>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
+EIGEN_STRONG_INLINE void DenseBase<Derived>::writePacket
(int index, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x)
{
ei_internal_assert(index >= 0 && index < size());
@@ -324,7 +324,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
*/
template<typename Derived>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int row, int col, const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE void DenseBase<Derived>::copyCoeff(int row, int col, const DenseBase<OtherDerived>& other)
{
ei_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
@@ -340,7 +340,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int row, int col, const
*/
template<typename Derived>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int index, const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE void DenseBase<Derived>::copyCoeff(int index, const DenseBase<OtherDerived>& other)
{
ei_internal_assert(index >= 0 && index < size());
derived().coeffRef(index) = other.derived().coeff(index);
@@ -355,7 +355,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int index, const MatrixB
*/
template<typename Derived>
template<typename OtherDerived, int StoreMode, int LoadMode>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyPacket(int row, int col, const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE void DenseBase<Derived>::copyPacket(int row, int col, const DenseBase<OtherDerived>& other)
{
ei_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
@@ -372,7 +372,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyPacket(int row, int col, const
*/
template<typename Derived>
template<typename OtherDerived, int StoreMode, int LoadMode>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyPacket(int index, const MatrixBase<OtherDerived>& other)
+EIGEN_STRONG_INLINE void DenseBase<Derived>::copyPacket(int index, const DenseBase<OtherDerived>& other)
{
ei_internal_assert(index >= 0 && index < size());
derived().template writePacket<StoreMode>(index,
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h
index 328c5580c..428e4d82d 100644
--- a/Eigen/src/Core/CommaInitializer.h
+++ b/Eigen/src/Core/CommaInitializer.h
@@ -47,7 +47,7 @@ struct CommaInitializer
}
template<typename OtherDerived>
- inline CommaInitializer(MatrixType& mat, const MatrixBase<OtherDerived>& other)
+ inline CommaInitializer(MatrixType& mat, const DenseBase<OtherDerived>& other)
: m_matrix(mat), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
{
m_matrix.block(0, 0, other.rows(), other.cols()) = other;
@@ -73,7 +73,7 @@ struct CommaInitializer
/* inserts a matrix expression in the target matrix */
template<typename OtherDerived>
- CommaInitializer& operator,(const MatrixBase<OtherDerived>& other)
+ CommaInitializer& operator,(const DenseBase<OtherDerived>& other)
{
if (m_col==m_matrix.cols())
{
@@ -133,7 +133,7 @@ private:
* \sa CommaInitializer::finished(), class CommaInitializer
*/
template<typename Derived>
-inline CommaInitializer<Derived> MatrixBase<Derived>::operator<< (const Scalar& s)
+inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s)
{
return CommaInitializer<Derived>(*static_cast<Derived*>(this), s);
}
@@ -142,7 +142,7 @@ inline CommaInitializer<Derived> MatrixBase<Derived>::operator<< (const Scalar&
template<typename Derived>
template<typename OtherDerived>
inline CommaInitializer<Derived>
-MatrixBase<Derived>::operator<<(const MatrixBase<OtherDerived>& other)
+DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other)
{
return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
}
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index 0b45261ae..c45c52494 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -140,7 +140,8 @@ class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
public:
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
- EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
+ typedef typename Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type Base;
+ _EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
{
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h
index 7c1984be6..0fc1ce41e 100644
--- a/Eigen/src/Core/CwiseNullaryOp.h
+++ b/Eigen/src/Core/CwiseNullaryOp.h
@@ -38,7 +38,7 @@
* However, if you want to write a function returning such an expression, you
* will need to use this class.
*
- * \sa class CwiseUnaryOp, class CwiseBinaryOp, MatrixBase::NullaryExpr()
+ * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr()
*/
template<typename NullaryOp, typename MatrixType>
struct ei_traits<CwiseNullaryOp<NullaryOp, MatrixType> > : ei_traits<MatrixType>
@@ -121,7 +121,7 @@ class CwiseNullaryOp : ei_no_assignment_operator,
template<typename Derived>
template<typename CustomNullaryOp>
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
-MatrixBase<Derived>::NullaryExpr(int rows, int cols, const CustomNullaryOp& func)
+DenseBase<Derived>::NullaryExpr(int rows, int cols, const CustomNullaryOp& func)
{
return CwiseNullaryOp<CustomNullaryOp, Derived>(rows, cols, func);
}
@@ -144,7 +144,7 @@ MatrixBase<Derived>::NullaryExpr(int rows, int cols, const CustomNullaryOp& func
template<typename Derived>
template<typename CustomNullaryOp>
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
-MatrixBase<Derived>::NullaryExpr(int size, const CustomNullaryOp& func)
+DenseBase<Derived>::NullaryExpr(int size, const CustomNullaryOp& func)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
if(RowsAtCompileTime == 1) return CwiseNullaryOp<CustomNullaryOp, Derived>(1, size, func);
@@ -153,7 +153,7 @@ MatrixBase<Derived>::NullaryExpr(int size, const CustomNullaryOp& func)
/** \returns an expression of a matrix defined by a custom functor \a func
*
- * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
+ * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
* need to use the variants taking size arguments.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -163,7 +163,7 @@ MatrixBase<Derived>::NullaryExpr(int size, const CustomNullaryOp& func)
template<typename Derived>
template<typename CustomNullaryOp>
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
-MatrixBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
+DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
{
return CwiseNullaryOp<CustomNullaryOp, Derived>(RowsAtCompileTime, ColsAtCompileTime, func);
}
@@ -171,7 +171,7 @@ MatrixBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
/** \returns an expression of a constant matrix of value \a value
*
* The parameters \a rows and \a cols are the number of rows and of columns of
- * the returned matrix. Must be compatible with this MatrixBase type.
+ * the returned matrix. Must be compatible with this DenseBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
@@ -182,8 +182,8 @@ MatrixBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
* \sa class CwiseNullaryOp
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Constant(int rows, int cols, const Scalar& value)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Constant(int rows, int cols, const Scalar& value)
{
return NullaryExpr(rows, cols, ei_scalar_constant_op<Scalar>(value));
}
@@ -191,7 +191,7 @@ MatrixBase<Derived>::Constant(int rows, int cols, const Scalar& value)
/** \returns an expression of a constant matrix of value \a value
*
* The parameter \a size is the size of the returned vector.
- * Must be compatible with this MatrixBase type.
+ * Must be compatible with this DenseBase type.
*
* \only_for_vectors
*
@@ -204,15 +204,15 @@ MatrixBase<Derived>::Constant(int rows, int cols, const Scalar& value)
* \sa class CwiseNullaryOp
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Constant(int size, const Scalar& value)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Constant(int size, const Scalar& value)
{
return NullaryExpr(size, ei_scalar_constant_op<Scalar>(value));
}
/** \returns an expression of a constant matrix of value \a value
*
- * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
+ * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
* need to use the variants taking size arguments.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -220,8 +220,8 @@ MatrixBase<Derived>::Constant(int size, const Scalar& value)
* \sa class CwiseNullaryOp
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Constant(const Scalar& value)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Constant(const Scalar& value)
{
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_constant_op<Scalar>(value));
@@ -229,12 +229,12 @@ MatrixBase<Derived>::Constant(const Scalar& value)
/** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
template<typename Derived>
-bool MatrixBase<Derived>::isApproxToConstant
+bool DenseBase<Derived>::isApproxToConstant
(const Scalar& value, RealScalar prec) const
{
for(int j = 0; j < cols(); ++j)
for(int i = 0; i < rows(); ++i)
- if(!ei_isApprox(coeff(i, j), value, prec))
+ if(!ei_isApprox(this->coeff(i, j), value, prec))
return false;
return true;
}
@@ -243,7 +243,7 @@ bool MatrixBase<Derived>::isApproxToConstant
*
* \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
template<typename Derived>
-bool MatrixBase<Derived>::isConstant
+bool DenseBase<Derived>::isConstant
(const Scalar& value, RealScalar prec) const
{
return isApproxToConstant(value, prec);
@@ -254,7 +254,7 @@ bool MatrixBase<Derived>::isConstant
* \sa setConstant(), Constant(), class CwiseNullaryOp
*/
template<typename Derived>
-EIGEN_STRONG_INLINE void MatrixBase<Derived>::fill(const Scalar& value)
+EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& value)
{
setConstant(value);
}
@@ -264,7 +264,7 @@ EIGEN_STRONG_INLINE void MatrixBase<Derived>::fill(const Scalar& value)
* \sa fill(), setConstant(int,const Scalar&), setConstant(int,int,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setConstant(const Scalar& value)
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& value)
{
return derived() = Constant(rows(), cols(), value);
}
@@ -322,8 +322,8 @@ Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::setConstant(int row
* \sa Zero(), Zero(int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Zero(int rows, int cols)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Zero(int rows, int cols)
{
return Constant(rows, cols, Scalar(0));
}
@@ -345,8 +345,8 @@ MatrixBase<Derived>::Zero(int rows, int cols)
* \sa Zero(), Zero(int,int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Zero(int size)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Zero(int size)
{
return Constant(size, Scalar(0));
}
@@ -362,8 +362,8 @@ MatrixBase<Derived>::Zero(int size)
* \sa Zero(int), Zero(int,int)
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Zero()
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Zero()
{
return Constant(Scalar(0));
}
@@ -377,11 +377,11 @@ MatrixBase<Derived>::Zero()
* \sa class CwiseNullaryOp, Zero()
*/
template<typename Derived>
-bool MatrixBase<Derived>::isZero(RealScalar prec) const
+bool DenseBase<Derived>::isZero(RealScalar prec) const
{
for(int j = 0; j < cols(); ++j)
for(int i = 0; i < rows(); ++i)
- if(!ei_isMuchSmallerThan(coeff(i, j), static_cast<Scalar>(1), prec))
+ if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast<Scalar>(1), prec))
return false;
return true;
}
@@ -394,7 +394,7 @@ bool MatrixBase<Derived>::isZero(RealScalar prec) const
* \sa class CwiseNullaryOp, Zero()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setZero()
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
{
return setConstant(Scalar(0));
}
@@ -406,7 +406,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setZero()
* Example: \include Matrix_setZero_int.cpp
* Output: \verbinclude Matrix_setZero_int.out
*
- * \sa MatrixBase::setZero(), setZero(int,int), class CwiseNullaryOp, MatrixBase::Zero()
+ * \sa DenseBase::setZero(), setZero(int,int), class CwiseNullaryOp, DenseBase::Zero()
*/
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
EIGEN_STRONG_INLINE Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>&
@@ -424,7 +424,7 @@ Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::setZero(int size)
* Example: \include Matrix_setZero_int_int.cpp
* Output: \verbinclude Matrix_setZero_int_int.out
*
- * \sa MatrixBase::setZero(), setZero(int), class CwiseNullaryOp, MatrixBase::Zero()
+ * \sa DenseBase::setZero(), setZero(int), class CwiseNullaryOp, DenseBase::Zero()
*/
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
EIGEN_STRONG_INLINE Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>&
@@ -451,8 +451,8 @@ Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::setZero(int rows, i
* \sa Ones(), Ones(int), isOnes(), class Ones
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Ones(int rows, int cols)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Ones(int rows, int cols)
{
return Constant(rows, cols, Scalar(1));
}
@@ -474,8 +474,8 @@ MatrixBase<Derived>::Ones(int rows, int cols)
* \sa Ones(), Ones(int,int), isOnes(), class Ones
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Ones(int size)
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Ones(int size)
{
return Constant(size, Scalar(1));
}
@@ -491,8 +491,8 @@ MatrixBase<Derived>::Ones(int size)
* \sa Ones(int), Ones(int,int), isOnes(), class Ones
*/
template<typename Derived>
-EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ConstantReturnType
-MatrixBase<Derived>::Ones()
+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
+DenseBase<Derived>::Ones()
{
return Constant(Scalar(1));
}
@@ -506,7 +506,7 @@ MatrixBase<Derived>::Ones()
* \sa class CwiseNullaryOp, Ones()
*/
template<typename Derived>
-bool MatrixBase<Derived>::isOnes
+bool DenseBase<Derived>::isOnes
(RealScalar prec) const
{
return isApproxToConstant(Scalar(1), prec);
@@ -520,7 +520,7 @@ bool MatrixBase<Derived>::isOnes
* \sa class CwiseNullaryOp, Ones()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setOnes()
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
{
return setConstant(Scalar(1));
}
@@ -620,12 +620,12 @@ bool MatrixBase<Derived>::isIdentity
{
if(i == j)
{
- if(!ei_isApprox(coeff(i, j), static_cast<Scalar>(1), prec))
+ if(!ei_isApprox(this->coeff(i, j), static_cast<Scalar>(1), prec))
return false;
}
else
{
- if(!ei_isMuchSmallerThan(coeff(i, j), static_cast<RealScalar>(1), prec))
+ if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast<RealScalar>(1), prec))
return false;
}
}
diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h
index abece413b..b4da532e6 100644
--- a/Eigen/src/Core/CwiseUnaryOp.h
+++ b/Eigen/src/Core/CwiseUnaryOp.h
@@ -106,7 +106,8 @@ class CwiseUnaryOpImpl<UnaryOp,MatrixType,Dense>
public:
typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
- EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
+ typedef typename MatrixType::template MakeBase< CwiseUnaryOp<UnaryOp, MatrixType> >::Type Base;
+ _EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
{
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
new file mode 100644
index 000000000..d4808cf06
--- /dev/null
+++ b/Eigen/src/Core/DenseBase.h
@@ -0,0 +1,517 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+// Copyright (C) 2008-2009 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
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EIGEN_DENSEBASE_H
+#define EIGEN_DENSEBASE_H
+
+/** \class DenseBase
+ *
+ * \brief Base class for all dense matrices, vectors, and arrays
+ *
+ * This class is the base that is inherited by all dense objects (matrix, vector, arrays, and expression
+ * types). The common Eigen API for dense object is contained in this class.
+ *
+ * \param Derived is the derived type, e.g. a matrix type, or an expression, etc.
+ */
+template<typename Derived> class DenseBase
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
+ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+{
+ public:
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
+ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
+
+ class InnerIterator;
+
+ typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ enum {
+
+ RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
+ /**< The number of rows at compile-time. This is just a copy of the value provided
+ * by the \a Derived type. If a value is not known at compile-time,
+ * it is set to the \a Dynamic constant.
+ * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
+
+ ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
+ /**< The number of columns at compile-time. This is just a copy of the value provided
+ * by the \a Derived type. If a value is not known at compile-time,
+ * it is set to the \a Dynamic constant.
+ * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
+
+
+ SizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::RowsAtCompileTime,
+ ei_traits<Derived>::ColsAtCompileTime>::ret),
+ /**< This is equal to the number of coefficients, i.e. the number of
+ * rows times the number of columns, or to \a Dynamic if this is not
+ * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
+
+ MaxRowsAtCompileTime = ei_traits<Derived>::MaxRowsAtCompileTime,
+ /**< This value is equal to the maximum possible number of rows that this expression
+ * might have. If this expression might have an arbitrarily high number of rows,
+ * this value is set to \a Dynamic.
+ *
+ * This value is useful to know when evaluating an expression, in order to determine
+ * whether it is possible to avoid doing a dynamic memory allocation.
+ *
+ * \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime
+ */
+
+ MaxColsAtCompileTime = ei_traits<Derived>::MaxColsAtCompileTime,
+ /**< This value is equal to the maximum possible number of columns that this expression
+ * might have. If this expression might have an arbitrarily high number of columns,
+ * this value is set to \a Dynamic.
+ *
+ * This value is useful to know when evaluating an expression, in order to determine
+ * whether it is possible to avoid doing a dynamic memory allocation.
+ *
+ * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime
+ */
+
+ MaxSizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::MaxRowsAtCompileTime,
+ ei_traits<Derived>::MaxColsAtCompileTime>::ret),
+ /**< This value is equal to the maximum possible number of coefficients that this expression
+ * might have. If this expression might have an arbitrarily high number of coefficients,
+ * this value is set to \a Dynamic.
+ *
+ * This value is useful to know when evaluating an expression, in order to determine
+ * whether it is possible to avoid doing a dynamic memory allocation.
+ *
+ * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime
+ */
+
+ IsVectorAtCompileTime = ei_traits<Derived>::RowsAtCompileTime == 1
+ || ei_traits<Derived>::ColsAtCompileTime == 1,
+ /**< This is set to true if either the number of rows or the number of
+ * columns is known at compile-time to be equal to 1. Indeed, in that case,
+ * we are dealing with a column-vector (if there is only one column) or with
+ * a row-vector (if there is only one row). */
+
+ Flags = ei_traits<Derived>::Flags,
+ /**< This stores expression \ref flags flags which may or may not be inherited by new expressions
+ * constructed from this one. See the \ref flags "list of flags".
+ */
+
+ CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
+ /**< This is a rough measure of how expensive it is to read one coefficient from
+ * this expression.
+ */
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC
+#endif
+ };
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ /** This is the "real scalar" type; if the \a Scalar type is already real numbers
+ * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If
+ * \a Scalar is \a std::complex<T> then RealScalar is \a T.
+ *
+ * \sa class NumTraits
+ */
+ typedef typename NumTraits<Scalar>::Real RealScalar;
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ /** \returns the number of rows. \sa cols(), RowsAtCompileTime */
+ inline int rows() const { return derived().rows(); }
+ /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/
+ inline int cols() const { return derived().cols(); }
+ /** \returns the number of coefficients, which is rows()*cols().
+ * \sa rows(), cols(), SizeAtCompileTime. */
+ inline int size() const { return rows() * cols(); }
+ /** \returns the number of nonzero coefficients which is in practice the number
+ * of stored coefficients. */
+ inline int nonZeros() const { return size(); }
+ /** \returns true if either the number of rows or the number of columns is equal to 1.
+ * In other words, this function returns
+ * \code rows()==1 || cols()==1 \endcode
+ * \sa rows(), cols(), IsVectorAtCompileTime. */
+ inline bool isVector() const { return rows()==1 || cols()==1; }
+ /** \returns the size of the storage major dimension,
+ * i.e., the number of columns for a columns major matrix, and the number of rows otherwise */
+ int outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); }
+ /** \returns the size of the inner dimension according to the storage order,
+ * i.e., the number of rows for a columns major matrix, and the number of cols otherwise */
+ int innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); }
+
+ /** Only plain matrices, not expressions may be resized; therefore the only useful resize method is
+ * Matrix::resize(). The present method only asserts that the new size equals the old size, and does
+ * nothing else.
+ */
+ void resize(int size)
+ {
+ ei_assert(size == this->size()
+ && "MatrixBase::resize() does not actually allow to resize.");
+ }
+ /** Only plain matrices, not expressions may be resized; therefore the only useful resize method is
+ * Matrix::resize(). The present method only asserts that the new size equals the old size, and does
+ * nothing else.
+ */
+ void resize(int rows, int cols)
+ {
+ ei_assert(rows == this->rows() && cols == this->cols()
+ && "MatrixBase::resize() does not actually allow to resize.");
+ }
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ /** \internal the return type of coeff()
+ */
+ typedef typename ei_meta_if<_HasDirectAccess, const Scalar&, Scalar>::ret CoeffReturnType;
+
+ /** \internal Represents a matrix with all coefficients equal to one another*/
+ typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Derived> ConstantReturnType;
+ /** \internal the return type of MatrixBase::eigenvalues() */
+ typedef Matrix<typename NumTraits<typename ei_traits<Derived>::Scalar>::Real, ei_traits<Derived>::ColsAtCompileTime, 1> EigenvaluesReturnType;
+ /** \internal expression tyepe of a column */
+ typedef Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> ColXpr;
+ /** \internal expression tyepe of a column */
+ typedef Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> RowXpr;
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ /** Copies \a other into *this. \returns a reference to *this. */
+ template<typename OtherDerived>
+ Derived& operator=(const DenseBase<OtherDerived>& other);
+
+ /** Special case of the template operator=, in order to prevent the compiler
+ * from generating a default operator= (issue hit with g++ 4.1)
+ */
+ Derived& operator=(const DenseBase& other);
+
+ template<typename OtherDerived>
+ Derived& operator=(const AnyMatrixBase<OtherDerived> &other);
+
+ template<typename OtherDerived>
+ Derived& operator+=(const AnyMatrixBase<OtherDerived> &other);
+
+ template<typename OtherDerived>
+ Derived& operator-=(const AnyMatrixBase<OtherDerived> &other);
+
+ template<typename OtherDerived>
+ Derived& operator=(const ReturnByValue<OtherDerived>& func);
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ /** Copies \a other into *this without evaluating other. \returns a reference to *this. */
+ template<typename OtherDerived>
+ Derived& lazyAssign(const DenseBase<OtherDerived>& other);
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ CommaInitializer<Derived> operator<< (const Scalar& s);
+
+ template<typename OtherDerived>
+ CommaInitializer<Derived> operator<< (const DenseBase<OtherDerived>& other);
+
+ const CoeffReturnType coeff(int row, int col) const;
+ const CoeffReturnType operator()(int row, int col) const;
+
+ Scalar& coeffRef(int row, int col);
+ Scalar& operator()(int row, int col);
+
+ const CoeffReturnType coeff(int index) const;
+ const CoeffReturnType operator[](int index) const;
+ const CoeffReturnType operator()(int index) const;
+
+ Scalar& coeffRef(int index);
+ Scalar& operator[](int index);
+ Scalar& operator()(int index);
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ template<typename OtherDerived>
+ void copyCoeff(int row, int col, const DenseBase<OtherDerived>& other);
+ template<typename OtherDerived>
+ void copyCoeff(int index, const DenseBase<OtherDerived>& other);
+ template<typename OtherDerived, int StoreMode, int LoadMode>
+ void copyPacket(int row, int col, const DenseBase<OtherDerived>& other);
+ template<typename OtherDerived, int StoreMode, int LoadMode>
+ void copyPacket(int index, const DenseBase<OtherDerived>& other);
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ template<int LoadMode>
+ PacketScalar packet(int row, int col) const;
+ template<int StoreMode>
+ void writePacket(int row, int col, const PacketScalar& x);
+
+ template<int LoadMode>
+ PacketScalar packet(int index) const;
+ template<int StoreMode>
+ void writePacket(int index, const PacketScalar& x);
+
+ template<typename OtherDerived>
+ Derived& operator+=(const DenseBase<OtherDerived>& other);
+ template<typename OtherDerived>
+ Derived& operator-=(const DenseBase<OtherDerived>& other);
+
+ Eigen::Transpose<Derived> transpose();
+ const Eigen::Transpose<Derived> transpose() const;
+ void transposeInPlace();
+ #ifndef EIGEN_NO_DEBUG
+ template<typename OtherDerived>
+ Derived& lazyAssign(const Transpose<OtherDerived>& other);
+ template<typename DerivedA, typename DerivedB>
+ Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,Transpose<DerivedA>,DerivedB>& other);
+ template<typename DerivedA, typename DerivedB>
+ Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> >& other);
+
+ template<typename OtherDerived>
+ Derived& lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > >& other);
+ template<typename DerivedA, typename DerivedB>
+ Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB>& other);
+ template<typename DerivedA, typename DerivedB>
+ Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > >& other);
+ #endif
+
+ RowXpr row(int i);
+ const RowXpr row(int i) const;
+
+ ColXpr col(int i);
+ const ColXpr col(int i) const;
+
+ typename BlockReturnType<Derived>::Type block(int startRow, int startCol, int blockRows, int blockCols);
+ const typename BlockReturnType<Derived>::Type
+ block(int startRow, int startCol, int blockRows, int blockCols) const;
+
+ VectorBlock<Derived> segment(int start, int size);
+ const VectorBlock<Derived> segment(int start, int size) const;
+
+ VectorBlock<Derived> start(int size);
+ const VectorBlock<Derived> start(int size) const;
+
+ VectorBlock<Derived> end(int size);
+ const VectorBlock<Derived> end(int size) const;
+
+ typename BlockReturnType<Derived>::Type corner(CornerType type, int cRows, int cCols);
+ const typename BlockReturnType<Derived>::Type corner(CornerType type, int cRows, int cCols) const;
+
+ template<int BlockRows, int BlockCols>
+ typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol);
+ template<int BlockRows, int BlockCols>
+ const typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol) const;
+
+ template<int CRows, int CCols>
+ typename BlockReturnType<Derived, CRows, CCols>::Type corner(CornerType type);
+ template<int CRows, int CCols>
+ const typename BlockReturnType<Derived, CRows, CCols>::Type corner(CornerType type) const;
+
+ template<int Size> VectorBlock<Derived,Size> start(void);
+ template<int Size> const VectorBlock<Derived,Size> start() const;
+
+ template<int Size> VectorBlock<Derived,Size> end();
+ template<int Size> const VectorBlock<Derived,Size> end() const;
+
+ template<int Size> VectorBlock<Derived,Size> segment(int start);
+ template<int Size> const VectorBlock<Derived,Size> segment(int start) const;
+
+ Diagonal<Derived,0> diagonal();
+ const Diagonal<Derived,0> diagonal() const;
+
+ template<int Index> Diagonal<Derived,Index> diagonal();
+ template<int Index> const Diagonal<Derived,Index> diagonal() const;
+
+ Diagonal<Derived, Dynamic> diagonal(int index);
+ const Diagonal<Derived, Dynamic> diagonal(int index) const;
+
+ template<unsigned int Mode> TriangularView<Derived, Mode> part();
+ template<unsigned int Mode> const TriangularView<Derived, Mode> part() const;
+
+ template<unsigned int Mode> TriangularView<Derived, Mode> triangularView();
+ template<unsigned int Mode> const TriangularView<Derived, Mode> triangularView() const;
+
+ template<unsigned int UpLo> SelfAdjointView<Derived, UpLo> selfadjointView();
+ template<unsigned int UpLo> const SelfAdjointView<Derived, UpLo> selfadjointView() const;
+
+ static const ConstantReturnType
+ Constant(int rows, int cols, const Scalar& value);
+ static const ConstantReturnType
+ Constant(int size, const Scalar& value);
+ static const ConstantReturnType
+ Constant(const Scalar& value);
+
+ template<typename CustomNullaryOp>
+ static const CwiseNullaryOp<CustomNullaryOp, Derived>
+ NullaryExpr(int rows, int cols, const CustomNullaryOp& func);
+ template<typename CustomNullaryOp>
+ static const CwiseNullaryOp<CustomNullaryOp, Derived>
+ NullaryExpr(int size, const CustomNullaryOp& func);
+ template<typename CustomNullaryOp>
+ static const CwiseNullaryOp<CustomNullaryOp, Derived>
+ NullaryExpr(const CustomNullaryOp& func);
+
+ static const ConstantReturnType Zero(int rows, int cols);
+ static const ConstantReturnType Zero(int size);
+ static const ConstantReturnType Zero();
+ static const ConstantReturnType Ones(int rows, int cols);
+ static const ConstantReturnType Ones(int size);
+ static const ConstantReturnType Ones();
+
+ void fill(const Scalar& value);
+ Derived& setConstant(const Scalar& value);
+ Derived& setZero();
+ Derived& setOnes();
+ Derived& setRandom();
+
+
+ template<typename OtherDerived>
+ bool isApprox(const DenseBase<OtherDerived>& other,
+ RealScalar prec = precision<Scalar>()) const;
+ bool isMuchSmallerThan(const RealScalar& other,
+ RealScalar prec = precision<Scalar>()) const;
+ template<typename OtherDerived>
+ bool isMuchSmallerThan(const DenseBase<OtherDerived>& other,
+ RealScalar prec = precision<Scalar>()) const;
+
+ bool isApproxToConstant(const Scalar& value, RealScalar prec = precision<Scalar>()) const;
+ bool isConstant(const Scalar& value, RealScalar prec = precision<Scalar>()) const;
+ bool isZero(RealScalar prec = precision<Scalar>()) const;
+ bool isOnes(RealScalar prec = precision<Scalar>()) const;
+
+// template<typename OtherDerived>
+// inline bool operator==(const DenseBase<OtherDerived>& other) const
+// { return cwiseEqual(other).all(); }
+//
+// template<typename OtherDerived>
+// inline bool operator!=(const DenseBase<OtherDerived>& other) const
+// { return cwiseNotEqual(other).all(); }
+
+
+ /** \returns the matrix or vector obtained by evaluating this expression.
+ *
+ * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
+ * a const reference, in order to avoid a useless copy.
+ */
+ EIGEN_STRONG_INLINE const typename ei_eval<Derived>::type eval() const
+ { return typename ei_eval<Derived>::type(derived()); }
+
+ template<typename OtherDerived>
+ void swap(DenseBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other);
+
+ /** \returns number of elements to skip to pass from one row (resp. column) to another
+ * for a row-major (resp. column-major) matrix.
+ * Combined with coeffRef() and the \ref flags flags, it allows a direct access to the data
+ * of the underlying matrix.
+ */
+ inline int stride(void) const { return derived().stride(); }
+
+ inline const NestByValue<Derived> nestByValue() const;
+ inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
+ inline ForceAlignedAccess<Derived> forceAlignedAccess();
+ template<bool Enable> inline const typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf() const;
+ template<bool Enable> inline typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf();
+
+ Scalar sum() const;
+ Scalar mean() const;
+ Scalar trace() const;
+
+ Scalar prod() const;
+
+ typename ei_traits<Derived>::Scalar minCoeff() const;
+ typename ei_traits<Derived>::Scalar maxCoeff() const;
+
+ typename ei_traits<Derived>::Scalar minCoeff(int* row, int* col) const;
+ typename ei_traits<Derived>::Scalar maxCoeff(int* row, int* col) const;
+
+ typename ei_traits<Derived>::Scalar minCoeff(int* index) const;
+ typename ei_traits<Derived>::Scalar maxCoeff(int* index) const;
+
+ template<typename BinaryOp>
+ typename ei_result_of<BinaryOp(typename ei_traits<Derived>::Scalar)>::type
+ redux(const BinaryOp& func) const;
+
+ template<typename Visitor>
+ void visit(Visitor& func) const;
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ using AnyMatrixBase<Derived>::derived;
+ inline Derived& const_cast_derived() const
+ { return *static_cast<Derived*>(const_cast<DenseBase*>(this)); }
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+ inline const WithFormat<Derived> format(const IOFormat& fmt) const;
+
+/////////// Array module ///////////
+
+ bool all(void) const;
+ bool any(void) const;
+ int count() const;
+
+ const VectorwiseOp<Derived,Horizontal> rowwise() const;
+ VectorwiseOp<Derived,Horizontal> rowwise();
+ const VectorwiseOp<Derived,Vertical> colwise() const;
+ VectorwiseOp<Derived,Vertical> colwise();
+
+ static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int rows, int cols);
+ static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int size);
+ static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random();
+
+ template<typename ThenDerived,typename ElseDerived>
+ const Select<Derived,ThenDerived,ElseDerived>
+ select(const DenseBase<ThenDerived>& thenMatrix,
+ const DenseBase<ElseDerived>& elseMatrix) const;
+
+ template<typename ThenDerived>
+ inline const Select<Derived,ThenDerived, NestByValue<typename ThenDerived::ConstantReturnType> >
+ select(const DenseBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
+
+ template<typename ElseDerived>
+ inline const Select<Derived, NestByValue<typename ElseDerived::ConstantReturnType>, ElseDerived >
+ select(typename ElseDerived::Scalar thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
+
+ template<int p> RealScalar lpNorm() const;
+
+ template<int RowFactor, int ColFactor>
+ const Replicate<Derived,RowFactor,ColFactor> replicate() const;
+ const Replicate<Derived,Dynamic,Dynamic> replicate(int rowFacor,int colFactor) const;
+
+ Eigen::Reverse<Derived, BothDirections> reverse();
+ const Eigen::Reverse<Derived, BothDirections> reverse() const;
+ void reverseInPlace();
+
+ #ifdef EIGEN_DENSEBASE_PLUGIN
+ #include EIGEN_DENSEBASE_PLUGIN
+ #endif
+
+ protected:
+ /** Default constructor. Do nothing. */
+ DenseBase()
+ {
+ /* Just checks for self-consistency of the flags.
+ * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down
+ */
+#ifdef EIGEN_INTERNAL_DEBUGGING
+ EIGEN_STATIC_ASSERT(ei_are_flags_consistent<Flags>::ret,
+ INVALID_MATRIXBASE_TEMPLATE_PARAMETERS)
+#endif
+ }
+
+ private:
+ explicit DenseBase(int);
+ DenseBase(int,int);
+ template<typename OtherDerived> explicit DenseBase(const DenseBase<OtherDerived>&);
+};
+
+#endif // EIGEN_DENSEBASE_H
diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h
index 13fcfcdab..fdc13d00d 100644
--- a/Eigen/src/Core/Fuzzy.h
+++ b/Eigen/src/Core/Fuzzy.h
@@ -47,8 +47,8 @@
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isApprox(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isApprox(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
@@ -68,15 +68,15 @@ bool MatrixBase<Derived>::isApprox(
* the value of the reference scalar \a other should come from the Hilbert-Schmidt norm
* of a reference matrix of same dimensions.
*
- * \sa isApprox(), isMuchSmallerThan(const MatrixBase<OtherDerived>&, RealScalar) const
+ * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
*/
template<typename Derived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
+bool DenseBase<Derived>::isMuchSmallerThan(
const typename NumTraits<Scalar>::Real& other,
RealScalar prec
) const
{
- return cwiseAbs2().sum() <= prec * prec * other * other;
+ return derived().cwiseAbs2().sum() <= prec * prec * other * other;
}
/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other,
@@ -91,12 +91,12 @@ bool MatrixBase<Derived>::isMuchSmallerThan(
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isMuchSmallerThan(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
- return cwiseAbs2().sum() <= prec * prec * other.cwiseAbs2().sum();
+ return derived().cwiseAbs2().sum() <= prec * prec * other.derived().cwiseAbs2().sum();
}
#else
@@ -122,8 +122,8 @@ struct ei_fuzzy_selector;
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isApprox(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isApprox(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
@@ -138,10 +138,10 @@ bool MatrixBase<Derived>::isApprox(
* \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f]
* For matrices, the comparison is done on all columns.
*
- * \sa isApprox(), isMuchSmallerThan(const MatrixBase<OtherDerived>&, RealScalar) const
+ * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
*/
template<typename Derived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
+bool DenseBase<Derived>::isMuchSmallerThan(
const typename NumTraits<Scalar>::Real& other,
RealScalar prec
) const
@@ -161,8 +161,8 @@ bool MatrixBase<Derived>::isMuchSmallerThan(
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isMuchSmallerThan(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h
index a44802ed2..e78b1792f 100644
--- a/Eigen/src/Core/IO.h
+++ b/Eigen/src/Core/IO.h
@@ -121,7 +121,7 @@ class WithFormat
*/
template<typename Derived>
inline const WithFormat<Derived>
-MatrixBase<Derived>::format(const IOFormat& fmt) const
+DenseBase<Derived>::format(const IOFormat& fmt) const
{
return WithFormat<Derived>(derived(), fmt);
}
@@ -190,21 +190,21 @@ std::ostream & ei_print_matrix(std::ostream & s, const Derived& _m, const IOForm
return s;
}
-/** \relates MatrixBase
+/** \relates DenseBase
*
* Outputs the matrix, to the given stream.
*
- * If you wish to print the matrix with a format different than the default, use MatrixBase::format().
+ * If you wish to print the matrix with a format different than the default, use DenseBase::format().
*
* It is also possible to change the default format by defining EIGEN_DEFAULT_IO_FORMAT before including Eigen headers.
* If not defined, this will automatically be defined to Eigen::IOFormat(), that is the Eigen::IOFormat with default parameters.
*
- * \sa MatrixBase::format()
+ * \sa DenseBase::format()
*/
template<typename Derived>
std::ostream & operator <<
(std::ostream & s,
- const MatrixBase<Derived> & m)
+ const DenseBase<Derived> & m)
{
return ei_print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT);
}
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index de93ce30b..18fafdece 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -58,11 +58,13 @@ struct ei_traits<Map<MatrixType, Options> > : public ei_traits<MatrixType>
};
template<typename MatrixType, int Options> class Map
- : public MapBase<Map<MatrixType, Options> >
+ : public MapBase<Map<MatrixType, Options>,
+ typename MatrixType::template MakeBase< Map<MatrixType, Options> >::Type>
{
public:
- _EIGEN_GENERIC_PUBLIC_INTERFACE(Map, MapBase<Map>)
+ typedef MapBase<Map,typename MatrixType::template MakeBase<Map>::Type> Base;
+ _EIGEN_GENERIC_PUBLIC_INTERFACE(Map)
inline int stride() const { return this->innerSize(); }
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h
index 31a0dbc6b..0067fbe16 100644
--- a/Eigen/src/Core/MapBase.h
+++ b/Eigen/src/Core/MapBase.h
@@ -32,12 +32,12 @@
*
* \sa class Map, class Block
*/
-template<typename Derived> class MapBase
- : public MatrixBase<Derived>
+template<typename Derived, typename Base> class MapBase
+ : public Base
{
public:
- typedef MatrixBase<Derived> Base;
+// typedef MatrixBase<Derived> Base;
enum {
IsRowMajor = (int(ei_traits<Derived>::Flags) & RowMajorBit) ? 1 : 0,
RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index 08d404f87..9cb13cf9b 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -52,10 +52,7 @@
* \endcode
*/
template<typename Derived> class MatrixBase
-#ifndef EIGEN_PARSED_BY_DOXYGEN
- : public ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
- typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>
-#endif // not EIGEN_PARSED_BY_DOXYGEN
+ : public DenseBase<Derived>
{
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
@@ -71,6 +68,13 @@ template<typename Derived> class MatrixBase
typedef typename ei_traits<Derived>::Scalar Scalar;
typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+
+ typedef DenseBase<Derived> Base;
+ using Base::rows;
+ using Base::cols;
+ using Base::size;
+ using Base::coeff;
+ using Base::coeffRef;
#endif // not EIGEN_PARSED_BY_DOXYGEN
enum {
@@ -165,12 +169,12 @@ template<typename Derived> class MatrixBase
#endif // not EIGEN_PARSED_BY_DOXYGEN
/** \returns the number of rows. \sa cols(), RowsAtCompileTime */
- inline int rows() const { return derived().rows(); }
+// inline int rows() const { return derived().rows(); }
/** \returns the number of columns. \sa rows(), ColsAtCompileTime*/
- inline int cols() const { return derived().cols(); }
+// inline int cols() const { return derived().cols(); }
/** \returns the number of coefficients, which is rows()*cols().
* \sa rows(), cols(), SizeAtCompileTime. */
- inline int size() const { return rows() * cols(); }
+// inline int size() const { return rows() * cols(); }
/** \returns the size of the main diagonal, which is min(rows(),cols()).
* \sa rows(), cols(), SizeAtCompileTime. */
inline int diagonalSize() const { return std::min(rows(),cols()); }
@@ -215,12 +219,19 @@ template<typename Derived> class MatrixBase
* PlainMatrixType or const PlainMatrixType&.
*/
typedef typename ei_plain_matrix_type<Derived>::type PlainMatrixType;
+// typedef Matrix<typename ei_traits<Derived>::Scalar,
+// ei_traits<Derived>::RowsAtCompileTime,
+// ei_traits<Derived>::ColsAtCompileTime,
+// AutoAlign | (ei_traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
+// ei_traits<Derived>::MaxRowsAtCompileTime,
+// ei_traits<Derived>::MaxColsAtCompileTime
+// > PlainMatrixType;
/** \internal the column-major plain matrix type corresponding to this expression. Note that is not necessarily
* exactly the return type of eval(): in the case of plain matrices, the return type of eval() is a const
* reference to a matrix, not a matrix!
* The only difference from PlainMatrixType is that PlainMatrixType_ColMajor is guaranteed to be column-major.
*/
- typedef typename ei_plain_matrix_type<Derived>::type PlainMatrixType_ColMajor;
+// typedef typename ei_plain_matrix_type<Derived>::type PlainMatrixType_ColMajor;
/** \internal the return type of coeff()
*/
@@ -249,15 +260,11 @@ template<typename Derived> class MatrixBase
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase
#include "../plugins/CommonCwiseUnaryOps.h"
- #include "../plugins/MatrixCwiseUnaryOps.h"
#include "../plugins/CommonCwiseBinaryOps.h"
+ #include "../plugins/MatrixCwiseUnaryOps.h"
#include "../plugins/MatrixCwiseBinaryOps.h"
#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
- /** Copies \a other into *this. \returns a reference to *this. */
- template<typename OtherDerived>
- Derived& operator=(const MatrixBase<OtherDerived>& other);
-
/** Special case of the template operator=, in order to prevent the compiler
* from generating a default operator= (issue hit with g++ 4.1)
*/
@@ -276,9 +283,10 @@ template<typename Derived> class MatrixBase
Derived& operator=(const ReturnByValue<OtherDerived>& func);
#ifndef EIGEN_PARSED_BY_DOXYGEN
+ using DenseBase<Derived>::lazyAssign;
/** Copies \a other into *this without evaluating other. \returns a reference to *this. */
- template<typename OtherDerived>
- Derived& lazyAssign(const MatrixBase<OtherDerived>& other);
+// template<typename OtherDerived>
+// Derived& lazyAssign(const MatrixBase<OtherDerived>& other);
template<typename ProductDerived, typename Lhs, typename Rhs>
Derived& lazyAssign(const ProductBase<ProductDerived, Lhs,Rhs>& other);
@@ -292,46 +300,6 @@ template<typename Derived> class MatrixBase
EvalBeforeAssigningBit>& other);
#endif // not EIGEN_PARSED_BY_DOXYGEN
- CommaInitializer<Derived> operator<< (const Scalar& s);
-
- template<typename OtherDerived>
- CommaInitializer<Derived> operator<< (const MatrixBase<OtherDerived>& other);
-
- const CoeffReturnType coeff(int row, int col) const;
- const CoeffReturnType operator()(int row, int col) const;
-
- Scalar& coeffRef(int row, int col);
- Scalar& operator()(int row, int col);
-
- const CoeffReturnType coeff(int index) const;
- const CoeffReturnType operator[](int index) const;
- const CoeffReturnType operator()(int index) const;
-
- Scalar& coeffRef(int index);
- Scalar& operator[](int index);
- Scalar& operator()(int index);
-
-#ifndef EIGEN_PARSED_BY_DOXYGEN
- template<typename OtherDerived>
- void copyCoeff(int row, int col, const MatrixBase<OtherDerived>& other);
- template<typename OtherDerived>
- void copyCoeff(int index, const MatrixBase<OtherDerived>& other);
- template<typename OtherDerived, int StoreMode, int LoadMode>
- void copyPacket(int row, int col, const MatrixBase<OtherDerived>& other);
- template<typename OtherDerived, int StoreMode, int LoadMode>
- void copyPacket(int index, const MatrixBase<OtherDerived>& other);
-#endif // not EIGEN_PARSED_BY_DOXYGEN
-
- template<int LoadMode>
- PacketScalar packet(int row, int col) const;
- template<int StoreMode>
- void writePacket(int row, int col, const PacketScalar& x);
-
- template<int LoadMode>
- PacketScalar packet(int index) const;
- template<int StoreMode>
- void writePacket(int index, const PacketScalar& x);
-
const CoeffReturnType x() const;
const CoeffReturnType y() const;
const CoeffReturnType z() const;
@@ -373,71 +341,12 @@ template<typename Derived> class MatrixBase
const PlainMatrixType normalized() const;
void normalize();
- Eigen::Transpose<Derived> transpose();
- const Eigen::Transpose<Derived> transpose() const;
- void transposeInPlace();
const AdjointReturnType adjoint() const;
void adjointInPlace();
- #ifndef EIGEN_NO_DEBUG
- template<typename OtherDerived>
- Derived& lazyAssign(const Transpose<OtherDerived>& other);
- template<typename DerivedA, typename DerivedB>
- Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,Transpose<DerivedA>,DerivedB>& other);
- template<typename DerivedA, typename DerivedB>
- Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> >& other);
-
- template<typename OtherDerived>
- Derived& lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > >& other);
- template<typename DerivedA, typename DerivedB>
- Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB>& other);
- template<typename DerivedA, typename DerivedB>
- Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > >& other);
- #endif
-
- RowXpr row(int i);
- const RowXpr row(int i) const;
-
- ColXpr col(int i);
- const ColXpr col(int i) const;
Minor<Derived> minor(int row, int col);
const Minor<Derived> minor(int row, int col) const;
- typename BlockReturnType<Derived>::Type block(int startRow, int startCol, int blockRows, int blockCols);
- const typename BlockReturnType<Derived>::Type
- block(int startRow, int startCol, int blockRows, int blockCols) const;
-
- VectorBlock<Derived> segment(int start, int size);
- const VectorBlock<Derived> segment(int start, int size) const;
-
- VectorBlock<Derived> start(int size);
- const VectorBlock<Derived> start(int size) const;
-
- VectorBlock<Derived> end(int size);
- const VectorBlock<Derived> end(int size) const;
-
- typename BlockReturnType<Derived>::Type corner(CornerType type, int cRows, int cCols);
- const typename BlockReturnType<Derived>::Type corner(CornerType type, int cRows, int cCols) const;
-
- template<int BlockRows, int BlockCols>
- typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol);
- template<int BlockRows, int BlockCols>
- const typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol) const;
-
- template<int CRows, int CCols>
- typename BlockReturnType<Derived, CRows, CCols>::Type corner(CornerType type);
- template<int CRows, int CCols>
- const typename BlockReturnType<Derived, CRows, CCols>::Type corner(CornerType type) const;
-
- template<int Size> VectorBlock<Derived,Size> start(void);
- template<int Size> const VectorBlock<Derived,Size> start() const;
-
- template<int Size> VectorBlock<Derived,Size> end();
- template<int Size> const VectorBlock<Derived,Size> end() const;
-
- template<int Size> VectorBlock<Derived,Size> segment(int start);
- template<int Size> const VectorBlock<Derived,Size> segment(int start) const;
-
Diagonal<Derived,0> diagonal();
const Diagonal<Derived,0> diagonal() const;
@@ -456,29 +365,6 @@ template<typename Derived> class MatrixBase
template<unsigned int UpLo> SelfAdjointView<Derived, UpLo> selfadjointView();
template<unsigned int UpLo> const SelfAdjointView<Derived, UpLo> selfadjointView() const;
- static const ConstantReturnType
- Constant(int rows, int cols, const Scalar& value);
- static const ConstantReturnType
- Constant(int size, const Scalar& value);
- static const ConstantReturnType
- Constant(const Scalar& value);
-
- template<typename CustomNullaryOp>
- static const CwiseNullaryOp<CustomNullaryOp, Derived>
- NullaryExpr(int rows, int cols, const CustomNullaryOp& func);
- template<typename CustomNullaryOp>
- static const CwiseNullaryOp<CustomNullaryOp, Derived>
- NullaryExpr(int size, const CustomNullaryOp& func);
- template<typename CustomNullaryOp>
- static const CwiseNullaryOp<CustomNullaryOp, Derived>
- NullaryExpr(const CustomNullaryOp& func);
-
- static const ConstantReturnType Zero(int rows, int cols);
- static const ConstantReturnType Zero(int size);
- static const ConstantReturnType Zero();
- static const ConstantReturnType Ones(int rows, int cols);
- static const ConstantReturnType Ones(int size);
- static const ConstantReturnType Ones();
static const IdentityReturnType Identity();
static const IdentityReturnType Identity(int rows, int cols);
static const BasisReturnType Unit(int size, int i);
@@ -490,27 +376,8 @@ template<typename Derived> class MatrixBase
const DiagonalWrapper<Derived> asDiagonal() const;
- void fill(const Scalar& value);
- Derived& setConstant(const Scalar& value);
- Derived& setZero();
- Derived& setOnes();
- Derived& setRandom();
Derived& setIdentity();
-
- template<typename OtherDerived>
- bool isApprox(const MatrixBase<OtherDerived>& other,
- RealScalar prec = precision<Scalar>()) const;
- bool isMuchSmallerThan(const RealScalar& other,
- RealScalar prec = precision<Scalar>()) const;
- template<typename OtherDerived>
- bool isMuchSmallerThan(const MatrixBase<OtherDerived>& other,
- RealScalar prec = precision<Scalar>()) const;
-
- bool isApproxToConstant(const Scalar& value, RealScalar prec = precision<Scalar>()) const;
- bool isConstant(const Scalar& value, RealScalar prec = precision<Scalar>()) const;
- bool isZero(RealScalar prec = precision<Scalar>()) const;
- bool isOnes(RealScalar prec = precision<Scalar>()) const;
bool isIdentity(RealScalar prec = precision<Scalar>()) const;
bool isDiagonal(RealScalar prec = precision<Scalar>()) const;
@@ -557,28 +424,9 @@ template<typename Derived> class MatrixBase
template<bool Enable> inline const typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf() const;
template<bool Enable> inline typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf();
- Scalar sum() const;
Scalar mean() const;
Scalar trace() const;
- Scalar prod() const;
-
- typename ei_traits<Derived>::Scalar minCoeff() const;
- typename ei_traits<Derived>::Scalar maxCoeff() const;
-
- typename ei_traits<Derived>::Scalar minCoeff(int* row, int* col) const;
- typename ei_traits<Derived>::Scalar maxCoeff(int* row, int* col) const;
-
- typename ei_traits<Derived>::Scalar minCoeff(int* index) const;
- typename ei_traits<Derived>::Scalar maxCoeff(int* index) const;
-
- template<typename BinaryOp>
- typename ei_result_of<BinaryOp(typename ei_traits<Derived>::Scalar)>::type
- redux(const BinaryOp& func) const;
-
- template<typename Visitor>
- void visit(Visitor& func) const;
-
#ifndef EIGEN_PARSED_BY_DOXYGEN
using AnyMatrixBase<Derived>::derived;
inline Derived& const_cast_derived() const
@@ -589,19 +437,11 @@ template<typename Derived> class MatrixBase
/////////// Array module ///////////
- bool all(void) const;
- bool any(void) const;
- int count() const;
-
const VectorwiseOp<Derived,Horizontal> rowwise() const;
VectorwiseOp<Derived,Horizontal> rowwise();
const VectorwiseOp<Derived,Vertical> colwise() const;
VectorwiseOp<Derived,Vertical> colwise();
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int rows, int cols);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int size);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random();
-
template<typename ThenDerived,typename ElseDerived>
const Select<Derived,ThenDerived,ElseDerived>
select(const MatrixBase<ThenDerived>& thenMatrix,
@@ -625,6 +465,9 @@ template<typename Derived> class MatrixBase
const Eigen::Reverse<Derived, BothDirections> reverse() const;
void reverseInPlace();
+ ArrayWrapper<Derived> array() { return derived(); }
+ const ArrayWrapper<Derived> array() const { return derived(); }
+
/////////// LU module ///////////
const FullPivLU<PlainMatrixType> fullPivLu() const;
@@ -727,9 +570,9 @@ template<typename Derived> class MatrixBase
inline Cwise<Derived> cwise();
// a workaround waiting the Array class
- inline const Cwise<Derived> array() const { return cwise(); }
+// inline const Cwise<Derived> array() const { return cwise(); }
// a workaround waiting the Array class
- inline Cwise<Derived> array() { return cwise(); }
+// inline Cwise<Derived> array() { return cwise(); }
template<typename OtherDerived>
typename ei_plain_matrix_type_column_major<OtherDerived>::type
diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h
index 68cff12d3..2cac09230 100644
--- a/Eigen/src/Core/ProductBase.h
+++ b/Eigen/src/Core/ProductBase.h
@@ -54,8 +54,8 @@ struct ei_nested<ProductBase<Derived,Lhs,Rhs>, N, EvalType>
};
#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \
- typedef ProductBase<Derived, Lhs, Rhs > ProductBaseType; \
- _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, ProductBaseType) \
+ typedef ProductBase<Derived, Lhs, Rhs > Base; \
+ _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
typedef typename Base::LhsNested LhsNested; \
typedef typename Base::_LhsNested _LhsNested; \
typedef typename Base::LhsBlasTraits LhsBlasTraits; \
@@ -73,7 +73,8 @@ template<typename Derived, typename Lhs, typename Rhs>
class ProductBase : public MatrixBase<Derived>
{
public:
- _EIGEN_GENERIC_PUBLIC_INTERFACE(ProductBase,MatrixBase<Derived>)
+ typedef MatrixBase<Derived> Base;
+ _EIGEN_GENERIC_PUBLIC_INTERFACE(ProductBase)
typedef typename Lhs::Nested LhsNested;
typedef typename ei_cleantype<LhsNested>::type _LhsNested;
diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h
index 9f796157a..b6b28c00b 100644
--- a/Eigen/src/Core/Redux.h
+++ b/Eigen/src/Core/Redux.h
@@ -309,12 +309,12 @@ struct ei_redux_impl<Func, Derived, LinearVectorization, CompleteUnrolling>
* The template parameter \a BinaryOp is the type of the functor \a func which must be
* an associative operator. Both current STL and TR1 functor styles are handled.
*
- * \sa MatrixBase::sum(), MatrixBase::minCoeff(), MatrixBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise()
+ * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise()
*/
template<typename Derived>
template<typename Func>
inline typename ei_result_of<Func(typename ei_traits<Derived>::Scalar)>::type
-MatrixBase<Derived>::redux(const Func& func) const
+DenseBase<Derived>::redux(const Func& func) const
{
typename Derived::Nested nested(derived());
typedef typename ei_cleantype<typename Derived::Nested>::type ThisNested;
@@ -326,7 +326,7 @@ MatrixBase<Derived>::redux(const Func& func) const
*/
template<typename Derived>
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::minCoeff() const
+DenseBase<Derived>::minCoeff() const
{
return this->redux(Eigen::ei_scalar_min_op<Scalar>());
}
@@ -335,7 +335,7 @@ MatrixBase<Derived>::minCoeff() const
*/
template<typename Derived>
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::maxCoeff() const
+DenseBase<Derived>::maxCoeff() const
{
return this->redux(Eigen::ei_scalar_max_op<Scalar>());
}
@@ -346,7 +346,7 @@ MatrixBase<Derived>::maxCoeff() const
*/
template<typename Derived>
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::sum() const
+DenseBase<Derived>::sum() const
{
return this->redux(Eigen::ei_scalar_sum_op<Scalar>());
}
@@ -357,7 +357,7 @@ MatrixBase<Derived>::sum() const
*/
template<typename Derived>
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::mean() const
+DenseBase<Derived>::mean() const
{
return this->redux(Eigen::ei_scalar_sum_op<Scalar>()) / this->size();
}
@@ -371,7 +371,7 @@ MatrixBase<Derived>::mean() const
*/
template<typename Derived>
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::prod() const
+DenseBase<Derived>::prod() const
{
return this->redux(Eigen::ei_scalar_product_op<Scalar>());
}
diff --git a/Eigen/src/Core/StableNorm.h b/Eigen/src/Core/StableNorm.h
index c2dd6b847..2874f0fd8 100644
--- a/Eigen/src/Core/StableNorm.h
+++ b/Eigen/src/Core/StableNorm.h
@@ -67,10 +67,10 @@ MatrixBase<Derived>::stableNorm() const
{
bi = ei_alignmentOffset(&const_cast_derived().coeffRef(0), n);
if (bi>0)
- ei_stable_norm_kernel(start(bi), ssq, scale, invScale);
+ ei_stable_norm_kernel(this->start(bi), ssq, scale, invScale);
}
for (; bi<n; bi+=blockSize)
- ei_stable_norm_kernel(segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale);
+ ei_stable_norm_kernel(this->segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale);
return scale * ei_sqrt(ssq);
}
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index 71821008e..b202f62c4 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -90,7 +90,7 @@ template<typename MatrixType> class Transpose
template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
- : public MatrixBase<Transpose<MatrixType> >
+ : public MatrixType::template MakeBase<Transpose<MatrixType> >::Type
{
const typename ei_cleantype<typename MatrixType::Nested>::type& matrix() const
{ return derived().nestedExpression(); }
@@ -99,8 +99,9 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
public:
- //EIGEN_DENSE_PUBLIC_INTERFACE(TransposeImpl,MatrixBase<Transpose<MatrixType> >)
- EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
+ //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_EXPRESSION_IMPL_COMMON(MatrixBase<Transpose<MatrixType> >)
@@ -174,7 +175,7 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
* \sa transposeInPlace(), adjoint() */
template<typename Derived>
inline Transpose<Derived>
-MatrixBase<Derived>::transpose()
+DenseBase<Derived>::transpose()
{
return derived();
}
@@ -186,7 +187,7 @@ MatrixBase<Derived>::transpose()
* \sa transposeInPlace(), adjoint() */
template<typename Derived>
inline const Transpose<Derived>
-MatrixBase<Derived>::transpose() const
+DenseBase<Derived>::transpose() const
{
return derived();
}
@@ -214,7 +215,7 @@ template<typename Derived>
inline const typename MatrixBase<Derived>::AdjointReturnType
MatrixBase<Derived>::adjoint() const
{
- return transpose().nestByValue();
+ return this->transpose().nestByValue();
}
/***************************************************************************
@@ -261,7 +262,7 @@ struct ei_inplace_transpose_selector<MatrixType,false> { // non square matrix
*
* \sa transpose(), adjoint(), adjointInPlace() */
template<typename Derived>
-inline void MatrixBase<Derived>::transposeInPlace()
+inline void DenseBase<Derived>::transposeInPlace()
{
ei_inplace_transpose_selector<Derived>::run(derived());
}
@@ -324,61 +325,61 @@ template<typename T> typename T::Scalar* ei_extract_data(const T& m)
template<typename Derived>
template<typename OtherDerived>
-Derived& MatrixBase<Derived>::lazyAssign(const Transpose<OtherDerived>& other)
+Derived& DenseBase<Derived>::lazyAssign(const Transpose<OtherDerived>& other)
{
ei_assert(ei_extract_data(other) != ei_extract_data(derived())
&& "aliasing detected during tranposition, please use transposeInPlace()");
- return lazyAssign(static_cast<const MatrixBase<Transpose<OtherDerived> >& >(other));
+ return lazyAssign(static_cast<const DenseBase<Transpose<OtherDerived> >& >(other));
}
template<typename Derived>
template<typename DerivedA, typename DerivedB>
-Derived& MatrixBase<Derived>::
+Derived& DenseBase<Derived>::
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,Transpose<DerivedA>,DerivedB>& other)
{
ei_assert(ei_extract_data(derived()) != ei_extract_data(other.lhs())
&& "aliasing detected during tranposition, please evaluate your expression");
- return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,Transpose<DerivedA>,DerivedB> >& >(other));
+ return lazyAssign(static_cast<const DenseBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,Transpose<DerivedA>,DerivedB> >& >(other));
}
template<typename Derived>
template<typename DerivedA, typename DerivedB>
-Derived& MatrixBase<Derived>::
+Derived& DenseBase<Derived>::
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> >& other)
{
ei_assert(ei_extract_data(derived()) != ei_extract_data(other.rhs())
&& "aliasing detected during tranposition, please evaluate your expression");
- return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> > >& >(other));
+ return lazyAssign(static_cast<const DenseBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> > >& >(other));
}
template<typename Derived>
template<typename OtherDerived> Derived&
-MatrixBase<Derived>::
+DenseBase<Derived>::
lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > >& other)
{
ei_assert(ei_extract_data(other) != ei_extract_data(derived())
&& "aliasing detected during tranposition, please use adjointInPlace()");
- return lazyAssign(static_cast<const MatrixBase<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > > >& >(other));
+ return lazyAssign(static_cast<const DenseBase<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > > >& >(other));
}
template<typename Derived>
template<typename DerivedA, typename DerivedB>
-Derived& MatrixBase<Derived>::
+Derived& DenseBase<Derived>::
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB>& other)
{
ei_assert(ei_extract_data(derived()) != ei_extract_data(other.lhs())
&& "aliasing detected during tranposition, please evaluate your expression");
- return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB> >& >(other));
+ return lazyAssign(static_cast<const DenseBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB> >& >(other));
}
template<typename Derived>
template<typename DerivedA, typename DerivedB>
-Derived& MatrixBase<Derived>::
+Derived& DenseBase<Derived>::
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > >& other)
{
ei_assert(ei_extract_data(derived()) != ei_extract_data(other.rhs())
&& "aliasing detected during tranposition, please evaluate your expression");
- return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > > >& >(other));
+ return lazyAssign(static_cast<const DenseBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > > >& >(other));
}
#endif
diff --git a/Eigen/src/Core/VectorBlock.h b/Eigen/src/Core/VectorBlock.h
index f3e4debf5..96af71b36 100644
--- a/Eigen/src/Core/VectorBlock.h
+++ b/Eigen/src/Core/VectorBlock.h
@@ -34,7 +34,7 @@
* \param Size size of the sub-vector we are taking at compile time (optional)
*
* This class represents an expression of either a fixed-size or dynamic-size sub-vector.
- * It is the return type of MatrixBase::segment(int,int) and MatrixBase::segment<int>(int) and
+ * It is the return type of DenseBase::segment(int,int) and DenseBase::segment<int>(int) and
* most of the time this is the only way it is used.
*
* However, if you want to directly maniputate sub-vector expressions,
@@ -53,7 +53,7 @@
* \include class_FixedVectorBlock.cpp
* Output: \verbinclude class_FixedVectorBlock.out
*
- * \sa class Block, MatrixBase::segment(int,int,int,int), MatrixBase::segment(int,int)
+ * \sa class Block, DenseBase::segment(int,int,int,int), DenseBase::segment(int,int)
*/
template<typename VectorType, int Size>
struct ei_traits<VectorBlock<VectorType, Size> >
@@ -70,12 +70,12 @@ template<typename VectorType, int Size> class VectorBlock
{
typedef Block<VectorType,
ei_traits<VectorType>::RowsAtCompileTime==1 ? 1 : Size,
- ei_traits<VectorType>::ColsAtCompileTime==1 ? 1 : Size> _Base;
+ ei_traits<VectorType>::ColsAtCompileTime==1 ? 1 : Size> Base;
enum {
IsColVector = ei_traits<VectorType>::ColsAtCompileTime==1
};
public:
- _EIGEN_GENERIC_PUBLIC_INTERFACE(VectorBlock, _Base)
+ _EIGEN_GENERIC_PUBLIC_INTERFACE(VectorBlock)
using Base::operator=;
using Base::operator+=;
@@ -121,7 +121,7 @@ template<typename VectorType, int Size> class VectorBlock
* \sa class Block, segment(int)
*/
template<typename Derived>
-inline VectorBlock<Derived> MatrixBase<Derived>
+inline VectorBlock<Derived> DenseBase<Derived>
::segment(int start, int size)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@@ -131,7 +131,7 @@ inline VectorBlock<Derived> MatrixBase<Derived>
/** This is the const version of segment(int,int).*/
template<typename Derived>
inline const VectorBlock<Derived>
-MatrixBase<Derived>::segment(int start, int size) const
+DenseBase<Derived>::segment(int start, int size) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived>(derived(), start, size);
@@ -154,7 +154,7 @@ MatrixBase<Derived>::segment(int start, int size) const
*/
template<typename Derived>
inline VectorBlock<Derived>
-MatrixBase<Derived>::start(int size)
+DenseBase<Derived>::start(int size)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived>(derived(), 0, size);
@@ -163,7 +163,7 @@ MatrixBase<Derived>::start(int size)
/** This is the const version of start(int).*/
template<typename Derived>
inline const VectorBlock<Derived>
-MatrixBase<Derived>::start(int size) const
+DenseBase<Derived>::start(int size) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived>(derived(), 0, size);
@@ -186,7 +186,7 @@ MatrixBase<Derived>::start(int size) const
*/
template<typename Derived>
inline VectorBlock<Derived>
-MatrixBase<Derived>::end(int size)
+DenseBase<Derived>::end(int size)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived>(derived(), this->size() - size, size);
@@ -195,7 +195,7 @@ MatrixBase<Derived>::end(int size)
/** This is the const version of end(int).*/
template<typename Derived>
inline const VectorBlock<Derived>
-MatrixBase<Derived>::end(int size) const
+DenseBase<Derived>::end(int size) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived>(derived(), this->size() - size, size);
@@ -217,7 +217,7 @@ MatrixBase<Derived>::end(int size) const
template<typename Derived>
template<int Size>
inline VectorBlock<Derived,Size>
-MatrixBase<Derived>::segment(int start)
+DenseBase<Derived>::segment(int start)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived,Size>(derived(), start);
@@ -227,7 +227,7 @@ MatrixBase<Derived>::segment(int start)
template<typename Derived>
template<int Size>
inline const VectorBlock<Derived,Size>
-MatrixBase<Derived>::segment(int start) const
+DenseBase<Derived>::segment(int start) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived,Size>(derived(), start);
@@ -247,7 +247,7 @@ MatrixBase<Derived>::segment(int start) const
template<typename Derived>
template<int Size>
inline VectorBlock<Derived,Size>
-MatrixBase<Derived>::start()
+DenseBase<Derived>::start()
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived,Size>(derived(), 0);
@@ -257,7 +257,7 @@ MatrixBase<Derived>::start()
template<typename Derived>
template<int Size>
inline const VectorBlock<Derived,Size>
-MatrixBase<Derived>::start() const
+DenseBase<Derived>::start() const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived,Size>(derived(), 0);
@@ -277,7 +277,7 @@ MatrixBase<Derived>::start() const
template<typename Derived>
template<int Size>
inline VectorBlock<Derived,Size>
-MatrixBase<Derived>::end()
+DenseBase<Derived>::end()
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived, Size>(derived(), size() - Size);
@@ -287,7 +287,7 @@ MatrixBase<Derived>::end()
template<typename Derived>
template<int Size>
inline const VectorBlock<Derived,Size>
-MatrixBase<Derived>::end() const
+DenseBase<Derived>::end() const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return VectorBlock<Derived, Size>(derived(), size() - Size);
diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h
index 590efc766..e6f02b79b 100644
--- a/Eigen/src/Core/Visitor.h
+++ b/Eigen/src/Core/Visitor.h
@@ -79,11 +79,11 @@ struct ei_visitor_impl<Visitor, Derived, Dynamic>
* \note compared to one or two \em for \em loops, visitors offer automatic
* unrolling for small fixed size matrix.
*
- * \sa minCoeff(int*,int*), maxCoeff(int*,int*), MatrixBase::redux()
+ * \sa minCoeff(int*,int*), maxCoeff(int*,int*), DenseBase::redux()
*/
template<typename Derived>
template<typename Visitor>
-void MatrixBase<Derived>::visit(Visitor& visitor) const
+void DenseBase<Derived>::visit(Visitor& visitor) const
{
const bool unroll = SizeAtCompileTime * CoeffReadCost
+ (SizeAtCompileTime-1) * ei_functor_traits<Visitor>::Cost
@@ -112,7 +112,7 @@ struct ei_coeff_visitor
/** \internal
* \brief Visitor computing the min coefficient with its value and coordinates
*
- * \sa MatrixBase::minCoeff(int*, int*)
+ * \sa DenseBase::minCoeff(int*, int*)
*/
template <typename Scalar>
struct ei_min_coeff_visitor : ei_coeff_visitor<Scalar>
@@ -138,7 +138,7 @@ struct ei_functor_traits<ei_min_coeff_visitor<Scalar> > {
/** \internal
* \brief Visitor computing the max coefficient with its value and coordinates
*
- * \sa MatrixBase::maxCoeff(int*, int*)
+ * \sa DenseBase::maxCoeff(int*, int*)
*/
template <typename Scalar>
struct ei_max_coeff_visitor : ei_coeff_visitor<Scalar>
@@ -164,11 +164,11 @@ struct ei_functor_traits<ei_max_coeff_visitor<Scalar> > {
/** \returns the minimum of all coefficients of *this
* and puts in *row and *col its location.
*
- * \sa MatrixBase::minCoeff(int*), MatrixBase::maxCoeff(int*,int*), MatrixBase::visitor(), MatrixBase::minCoeff()
+ * \sa DenseBase::minCoeff(int*), DenseBase::maxCoeff(int*,int*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::minCoeff(int* row, int* col) const
+DenseBase<Derived>::minCoeff(int* row, int* col) const
{
ei_min_coeff_visitor<Scalar> minVisitor;
this->visit(minVisitor);
@@ -180,11 +180,11 @@ MatrixBase<Derived>::minCoeff(int* row, int* col) const
/** \returns the minimum of all coefficients of *this
* and puts in *index its location.
*
- * \sa MatrixBase::minCoeff(int*,int*), MatrixBase::maxCoeff(int*,int*), MatrixBase::visitor(), MatrixBase::minCoeff()
+ * \sa DenseBase::minCoeff(int*,int*), DenseBase::maxCoeff(int*,int*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::minCoeff(int* index) const
+DenseBase<Derived>::minCoeff(int* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
ei_min_coeff_visitor<Scalar> minVisitor;
@@ -196,11 +196,11 @@ MatrixBase<Derived>::minCoeff(int* index) const
/** \returns the maximum of all coefficients of *this
* and puts in *row and *col its location.
*
- * \sa MatrixBase::minCoeff(int*,int*), MatrixBase::visitor(), MatrixBase::maxCoeff()
+ * \sa DenseBase::minCoeff(int*,int*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::maxCoeff(int* row, int* col) const
+DenseBase<Derived>::maxCoeff(int* row, int* col) const
{
ei_max_coeff_visitor<Scalar> maxVisitor;
this->visit(maxVisitor);
@@ -212,11 +212,11 @@ MatrixBase<Derived>::maxCoeff(int* row, int* col) const
/** \returns the maximum of all coefficients of *this
* and puts in *index its location.
*
- * \sa MatrixBase::maxCoeff(int*,int*), MatrixBase::minCoeff(int*,int*), MatrixBase::visitor(), MatrixBase::maxCoeff()
+ * \sa DenseBase::maxCoeff(int*,int*), DenseBase::minCoeff(int*,int*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
typename ei_traits<Derived>::Scalar
-MatrixBase<Derived>::maxCoeff(int* index) const
+DenseBase<Derived>::maxCoeff(int* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
ei_max_coeff_visitor<Scalar> maxVisitor;
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h
index 76ac0eb3e..bcd79468c 100644
--- a/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -65,6 +65,7 @@ template<typename MatrixType, unsigned int Mode> class SelfAdjointView;
template<typename ExpressionType> class WithFormat;
template<typename MatrixType> struct CommaInitializer;
template<typename Derived> class ReturnByValue;
+template<typename ExpressionType> class ArrayWrapper;
template<typename DecompositionType, typename Rhs> struct ei_solve_retval_base;
template<typename DecompositionType, typename Rhs> struct ei_solve_retval;
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 6758d5766..d68538f1a 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -281,8 +281,7 @@ using Eigen::ei_cos;
using Base::operator /=; \
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
-#define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \
- typedef BaseClass Base; \
+#define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
typedef typename Base::PacketScalar PacketScalar; \
@@ -299,7 +298,8 @@ using Eigen::ei_cos;
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
- _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, Eigen::MatrixBase<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; \
@@ -315,8 +315,7 @@ using Eigen::ei_cos;
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
-#define _EIGEN_DENSE_PUBLIC_INTERFACE(Derived, BaseClass) \
- typedef BaseClass Base; \
+#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; \
@@ -334,7 +333,8 @@ using Eigen::ei_cos;
using Base::derived;
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
- _EIGEN_DENSE_PUBLIC_INTERFACE(Derived, Eigen::MatrixBase<Derived>)
+ typedef Eigen::MatrixBase<Derived> Base; \
+ _EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
#define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
@@ -344,4 +344,13 @@ using Eigen::ei_cos;
#define EIGEN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
#define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
+
+#define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
+ template<typename OtherDerived> \
+ inline const CwiseBinaryOp<FUNCTOR<Scalar>, Derived, OtherDerived> \
+ METHOD(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
+ { \
+ return CwiseBinaryOp<FUNCTOR<Scalar>, Derived, OtherDerived>(derived(), other.derived()); \
+ }
+
#endif // EIGEN_MACROS_H
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index 4e2c24f30..5e37194f3 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -133,6 +133,7 @@ struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>,
*/
template<typename T> struct ei_plain_matrix_type
{
+// typedef typename T::PlainMatrixType type;
typedef Matrix<typename ei_traits<T>::Scalar,
ei_traits<T>::RowsAtCompileTime,
ei_traits<T>::ColsAtCompileTime,