aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/MatrixBase.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/MatrixBase.h')
-rw-r--r--Eigen/src/Core/MatrixBase.h213
1 files changed, 28 insertions, 185 deletions
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