aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/AnyMatrixBase.h2
-rw-r--r--Eigen/src/Core/Block.h6
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h6
-rw-r--r--Eigen/src/Core/DenseStorageBase.h2
-rw-r--r--Eigen/src/Core/Fuzzy.h3
-rw-r--r--Eigen/src/Core/Matrix.h1
-rw-r--r--Eigen/src/Core/MatrixBase.h16
-rw-r--r--Eigen/src/Core/SelfCwiseBinaryOp.h16
-rw-r--r--Eigen/src/Core/util/Constants.h3
-rw-r--r--Eigen/src/Core/util/XprHelper.h77
10 files changed, 91 insertions, 41 deletions
diff --git a/Eigen/src/Core/AnyMatrixBase.h b/Eigen/src/Core/AnyMatrixBase.h
index 6035585e8..0522c1d5e 100644
--- a/Eigen/src/Core/AnyMatrixBase.h
+++ b/Eigen/src/Core/AnyMatrixBase.h
@@ -37,7 +37,7 @@
*/
template<typename Derived> struct AnyMatrixBase
{
- typedef typename ei_plain_matrix_type<Derived>::type PlainMatrixType;
+// typedef typename ei_plain_matrix_type<Derived>::type PlainMatrixType;
/** \returns a reference to the derived object */
Derived& derived() { return *static_cast<Derived*>(this); }
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index 598d846ea..461652410 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -58,12 +58,11 @@
* \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> >
+struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> > : ei_traits<MatrixType>
{
typedef typename ei_traits<MatrixType>::Scalar Scalar;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
- typedef typename ei_traits<MatrixType>::StorageType StorageType;
enum{
RowsAtCompileTime = BlockRows,
ColsAtCompileTime = BlockCols,
@@ -77,8 +76,7 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >
MaskPacketAccessBit = (InnerMaxSize == Dynamic || (InnerSize >= ei_packet_traits<Scalar>::size))
? PacketAccessBit : 0,
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
- Flags = (ei_traits<MatrixType>::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit)) | FlagsLinearAccessBit,
- CoeffReadCost = ei_traits<MatrixType>::CoeffReadCost
+ Flags = (ei_traits<MatrixType>::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit)) | FlagsLinearAccessBit
};
};
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index dc24d8e4c..954ea9275 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -44,7 +44,7 @@
* \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp
*/
template<typename BinaryOp, typename Lhs, typename Rhs>
-struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
+struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > : ei_traits<Lhs>
{
// even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor),
// we still want to handle the case when the result type is different.
@@ -65,10 +65,6 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
RhsCoeffReadCost = _RhsNested::CoeffReadCost,
LhsFlags = _LhsNested::Flags,
RhsFlags = _RhsNested::Flags,
- RowsAtCompileTime = Lhs::RowsAtCompileTime,
- ColsAtCompileTime = Lhs::ColsAtCompileTime,
- MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
Flags = (int(LhsFlags) | int(RhsFlags)) & (
HereditaryBits
| (int(LhsFlags) & int(RhsFlags) & (LinearAccessBit | AlignedBit))
diff --git a/Eigen/src/Core/DenseStorageBase.h b/Eigen/src/Core/DenseStorageBase.h
index b62e34413..b9257156e 100644
--- a/Eigen/src/Core/DenseStorageBase.h
+++ b/Eigen/src/Core/DenseStorageBase.h
@@ -307,7 +307,7 @@ class DenseStorageBase : public _Base<Derived>
/** \sa MatrixBase::lazyAssign() */
template<typename OtherDerived>
- EIGEN_STRONG_INLINE Derived& lazyAssign(const MatrixBase<OtherDerived>& other)
+ EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase<OtherDerived>& other)
{
_resize_to_match(other);
return Base::lazyAssign(other.derived());
diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h
index fdc13d00d..dfa042377 100644
--- a/Eigen/src/Core/Fuzzy.h
+++ b/Eigen/src/Core/Fuzzy.h
@@ -54,6 +54,9 @@ bool DenseBase<Derived>::isApprox(
{
const typename ei_nested<Derived,2>::type nested(derived());
const typename ei_nested<OtherDerived,2>::type otherNested(other.derived());
+// std::cerr << typeid(Derived).name() << " => " << typeid(typename ei_nested<Derived,2>::type).name() << "\n";
+// std::cerr << typeid(OtherDerived).name() << " => " << typeid(typename ei_nested<OtherDerived,2>::type).name() << "\n";
+// return false;
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * std::min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
}
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index 3815fffe7..75c0a73b5 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -112,6 +112,7 @@ struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef _Scalar Scalar;
typedef Dense StorageType;
+ typedef DenseStorageMatrix DenseStorageType;
enum {
RowsAtCompileTime = _Rows,
ColsAtCompileTime = _Cols,
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index 4c7113602..53dd6f991 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -124,14 +124,14 @@ template<typename Derived> class MatrixBase
* reference to a matrix, not a matrix! It is however guaranteed that the return type of eval() is either
* 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;
+// 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!
diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h
index ac0ccd963..ad5dc819b 100644
--- a/Eigen/src/Core/SelfCwiseBinaryOp.h
+++ b/Eigen/src/Core/SelfCwiseBinaryOp.h
@@ -35,11 +35,15 @@ template<typename BinaryOp, typename MatrixType>
struct ei_traits<SelfCwiseBinaryOp<BinaryOp,MatrixType> > : ei_traits<MatrixType> {};
template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
- : public MatrixBase<SelfCwiseBinaryOp<BinaryOp,MatrixType> >
+ //: public MatrixBase<SelfCwiseBinaryOp<BinaryOp,MatrixType> >
+ : public MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type
{
public:
- EIGEN_GENERIC_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
+ typedef typename MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type Base;
+ _EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
+
+// EIGEN_GENERIC_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
typedef typename ei_packet_traits<Scalar>::type Packet;
using Base::operator=;
@@ -65,7 +69,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
}
template<typename OtherDerived>
- void copyCoeff(int row, int col, const MatrixBase<OtherDerived>& other)
+ void copyCoeff(int row, int col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
ei_internal_assert(row >= 0 && row < rows()
@@ -75,7 +79,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
}
template<typename OtherDerived>
- void copyCoeff(int index, const MatrixBase<OtherDerived>& other)
+ void copyCoeff(int index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
ei_internal_assert(index >= 0 && index < m_matrix.size());
@@ -84,7 +88,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
}
template<typename OtherDerived, int StoreMode, int LoadMode>
- void copyPacket(int row, int col, const MatrixBase<OtherDerived>& other)
+ void copyPacket(int row, int col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
ei_internal_assert(row >= 0 && row < rows()
@@ -94,7 +98,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
}
template<typename OtherDerived, int StoreMode, int LoadMode>
- void copyPacket(int index, const MatrixBase<OtherDerived>& other)
+ void copyPacket(int index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
ei_internal_assert(index >= 0 && index < m_matrix.size());
diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h
index ee2a3d27d..beb19cdaa 100644
--- a/Eigen/src/Core/util/Constants.h
+++ b/Eigen/src/Core/util/Constants.h
@@ -271,6 +271,9 @@ const int EiArch_Generic = 0x0;
const int EiArch_SSE = 0x1;
const int EiArch_AltiVec = 0x2;
+enum DenseStorageMatrix {};
+enum DenseStorageArray {};
+
#if defined EIGEN_VECTORIZE_SSE
const int EiArch = EiArch_SSE;
#elif defined EIGEN_VECTORIZE_ALTIVEC
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index 6b9dbc781..6d6540acc 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -104,13 +104,35 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
enum { ret = (_Rows==Dynamic || _Cols==Dynamic) ? Dynamic : _Rows * _Cols };
};
-/* ei_eval : the return type of eval(). For matrices, this is just a const reference
- * in order to avoid a useless copy
+/* ei_plain_matrix_type : the difference from ei_eval is that ei_plain_matrix_type is always a plain matrix type,
+ * whereas ei_eval is a const reference in the case of a matrix
*/
-template<typename T, typename StorageType = typename ei_traits<T>::StorageType> class ei_eval;
+// template<typename Derived> class MatrixBase;
+// template<typename Derived> class ArrayBase;
+// template<typename Object> struct ei_is_matrix_or_array
+// {
+// struct is_matrix {int a[1];};
+// struct is_array {int a[2];};
+// struct is_none {int a[3];};
+//
+// template<typename T>
+// static is_matrix testBaseClass(const MatrixBase<T>*);
+// template<typename T>
+// static is_array testBaseClass(const ArrayBase<T>*);
+// // static is_none testBaseClass(...);
+//
+// enum {BaseClassType = sizeof(testBaseClass(static_cast<const Object*>(0)))};
+// };
-template<typename T> struct ei_eval<T,Dense>
+template<typename T, typename StorageType = typename ei_traits<T>::StorageType> class ei_plain_matrix_type;
+template<typename T, typename BaseClassType> struct ei_plain_matrix_type_dense;
+template<typename T> struct ei_plain_matrix_type<T,Dense>
+{
+ typedef typename ei_plain_matrix_type_dense<T,typename ei_traits<T>::DenseStorageType>::type type;
+};
+
+template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageMatrix>
{
typedef Matrix<typename ei_traits<T>::Scalar,
ei_traits<T>::RowsAtCompileTime,
@@ -121,6 +143,36 @@ template<typename T> struct ei_eval<T,Dense>
> type;
};
+template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageArray>
+{
+ typedef Array<typename ei_traits<T>::Scalar,
+ ei_traits<T>::RowsAtCompileTime,
+ ei_traits<T>::ColsAtCompileTime,
+ AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ ei_traits<T>::MaxRowsAtCompileTime,
+ ei_traits<T>::MaxColsAtCompileTime
+ > type;
+};
+
+/* ei_eval : the return type of eval(). For matrices, this is just a const reference
+ * in order to avoid a useless copy
+ */
+
+template<typename T, typename StorageType = typename ei_traits<T>::StorageType> class ei_eval;
+
+template<typename T> struct ei_eval<T,Dense>
+{
+ typedef typename ei_plain_matrix_type<T>::type type;
+// typedef typename T::PlainMatrixType type;
+// typedef T::Matrix<typename ei_traits<T>::Scalar,
+// ei_traits<T>::RowsAtCompileTime,
+// ei_traits<T>::ColsAtCompileTime,
+// AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+// ei_traits<T>::MaxRowsAtCompileTime,
+// ei_traits<T>::MaxColsAtCompileTime
+// > type;
+};
+
// for matrices, no need to evaluate, just use a const reference to avoid a useless copy
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>, Dense>
@@ -128,21 +180,14 @@ struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>,
typedef const Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>& type;
};
-/* ei_plain_matrix_type : the difference from ei_eval is that ei_plain_matrix_type is always a plain matrix type,
- * whereas ei_eval is a const reference in the case of a matrix
- */
-template<typename T> struct ei_plain_matrix_type
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
+struct ei_eval<Array<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>, Dense>
{
-// typedef typename T::PlainMatrixType type;
- typedef Matrix<typename ei_traits<T>::Scalar,
- ei_traits<T>::RowsAtCompileTime,
- ei_traits<T>::ColsAtCompileTime,
- AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
- ei_traits<T>::MaxRowsAtCompileTime,
- ei_traits<T>::MaxColsAtCompileTime
- > type;
+ typedef const Array<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>& type;
};
+
+
/* ei_plain_matrix_type_column_major : same as ei_plain_matrix_type but guaranteed to be column-major
*/
template<typename T> struct ei_plain_matrix_type_column_major