rename Object -> MatrixBase

This commit is contained in:
Benoit Jacob 2007-11-27 13:57:51 +00:00
parent 344623e872
commit 39f1776bde
28 changed files with 102 additions and 101 deletions

View File

@ -5,14 +5,14 @@ USING_EIGEN_DATA_TYPES
using namespace std; using namespace std;
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
void foo(const Eigen::Object<Scalar, Derived>& m) void foo(const Eigen::MatrixBase<Scalar, Derived>& m)
{ {
cout << "Here's m:" << endl << m << endl; cout << "Here's m:" << endl << m << endl;
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Eigen::ScalarMultiple<Derived> Eigen::ScalarMultiple<Derived>
twice(const Eigen::Object<Scalar, Derived>& m) twice(const Eigen::MatrixBase<Scalar, Derived>& m)
{ {
return 2 * m; return 2 * m;
} }

View File

@ -6,7 +6,7 @@ namespace Eigen {
#include "Core/Util.h" #include "Core/Util.h"
#include "Core/NumTraits.h" #include "Core/NumTraits.h"
#include "Core/Object.h" #include "Core/MatrixBase.h"
#include "Core/CopyHelper.h" #include "Core/CopyHelper.h"
#include "Core/MatrixRef.h" #include "Core/MatrixRef.h"
#include "Core/MatrixStorage.h" #include "Core/MatrixStorage.h"

View File

@ -27,12 +27,12 @@
#define EIGEN_BLOCK_H #define EIGEN_BLOCK_H
template<typename MatrixType> class Block template<typename MatrixType> class Block
: public Object<typename MatrixType::Scalar, Block<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Block<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Block<MatrixType> >; friend class MatrixBase<Scalar, Block<MatrixType> >;
static const int RowsAtCompileTime = Dynamic, static const int RowsAtCompileTime = Dynamic,
ColsAtCompileTime = Dynamic; ColsAtCompileTime = Dynamic;
@ -75,9 +75,9 @@ template<typename MatrixType> class Block
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Block<Derived> Block<Derived>
Object<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol) const MatrixBase<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol) const
{ {
return Block<Derived>(static_cast<Derived*>(const_cast<Object*>(this))->ref(), return Block<Derived>(static_cast<Derived*>(const_cast<MatrixBase*>(this))->ref(),
startRow, endRow, startCol, endCol); startRow, endRow, startCol, endCol);
} }

View File

@ -27,12 +27,12 @@
#define EIGEN_CAST_H #define EIGEN_CAST_H
template<typename NewScalar, typename MatrixType> class Cast template<typename NewScalar, typename MatrixType> class Cast
: public Object<NewScalar, Cast<NewScalar, MatrixType> > : public MatrixBase<NewScalar, Cast<NewScalar, MatrixType> >
{ {
public: public:
typedef NewScalar Scalar; typedef NewScalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Cast<Scalar, MatrixType> >; friend class MatrixBase<Scalar, Cast<Scalar, MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -62,7 +62,7 @@ template<typename NewScalar, typename MatrixType> class Cast
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename NewScalar> template<typename NewScalar>
Cast<NewScalar, Derived> Cast<NewScalar, Derived>
Object<Scalar, Derived>::cast() const MatrixBase<Scalar, Derived>::cast() const
{ {
return Cast<NewScalar, Derived>(static_cast<const Derived*>(this)->ref()); return Cast<NewScalar, Derived>(static_cast<const Derived*>(this)->ref());
} }

View File

@ -27,12 +27,12 @@
#define EIGEN_COLUMN_H #define EIGEN_COLUMN_H
template<typename MatrixType> class Column template<typename MatrixType> class Column
: public Object<typename MatrixType::Scalar, Column<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Column<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Column<MatrixType> >; friend class MatrixBase<Scalar, Column<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = 1; ColsAtCompileTime = 1;
@ -74,9 +74,9 @@ template<typename MatrixType> class Column
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Column<Derived> Column<Derived>
Object<Scalar, Derived>::col(int i) const MatrixBase<Scalar, Derived>::col(int i) const
{ {
return Column<Derived>(static_cast<Derived*>(const_cast<Object*>(this))->ref(), i); return Column<Derived>(static_cast<Derived*>(const_cast<MatrixBase*>(this))->ref(), i);
} }
#endif // EIGEN_COLUMN_H #endif // EIGEN_COLUMN_H

View File

@ -27,12 +27,12 @@
#define EIGEN_CONJUGATE_H #define EIGEN_CONJUGATE_H
template<typename MatrixType> class Conjugate template<typename MatrixType> class Conjugate
: public Object<typename MatrixType::Scalar, Conjugate<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Conjugate<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Conjugate<MatrixType> >; friend class MatrixBase<Scalar, Conjugate<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -61,7 +61,7 @@ template<typename MatrixType> class Conjugate
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Conjugate<Derived> Conjugate<Derived>
Object<Scalar, Derived>::conjugate() const MatrixBase<Scalar, Derived>::conjugate() const
{ {
return Conjugate<Derived>(static_cast<const Derived*>(this)->ref()); return Conjugate<Derived>(static_cast<const Derived*>(this)->ref());
} }

View File

@ -61,7 +61,7 @@ template<int Rows> struct CopyHelperUnroller<Dynamic, Rows>
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
void Object<Scalar, Derived>::_copy_helper(const Object<Scalar, OtherDerived>& other) void MatrixBase<Scalar, Derived>::_copy_helper(const MatrixBase<Scalar, OtherDerived>& other)
{ {
if(SizeAtCompileTime != Dynamic && SizeAtCompileTime <= EIGEN_LOOP_UNROLLING_LIMIT) if(SizeAtCompileTime != Dynamic && SizeAtCompileTime <= EIGEN_LOOP_UNROLLING_LIMIT)
CopyHelperUnroller<SizeAtCompileTime, RowsAtCompileTime>::run(*this, other); CopyHelperUnroller<SizeAtCompileTime, RowsAtCompileTime>::run(*this, other);

View File

@ -27,13 +27,13 @@
#define EIGEN_DIFFERENCE_H #define EIGEN_DIFFERENCE_H
template<typename Lhs, typename Rhs> class Difference template<typename Lhs, typename Rhs> class Difference
: public Object<typename Lhs::Scalar, Difference<Lhs, Rhs> > : public MatrixBase<typename Lhs::Scalar, Difference<Lhs, Rhs> >
{ {
public: public:
typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Scalar Scalar;
typedef typename Lhs::Ref LhsRef; typedef typename Lhs::Ref LhsRef;
typedef typename Rhs::Ref RhsRef; typedef typename Rhs::Ref RhsRef;
friend class Object<Scalar, Difference>; friend class MatrixBase<Scalar, Difference>;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -67,7 +67,7 @@ template<typename Lhs, typename Rhs> class Difference
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
Difference<Derived1, Derived2> Difference<Derived1, Derived2>
operator-(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &mat2) operator-(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{ {
return Difference<Derived1, Derived2>(mat1.ref(), mat2.ref()); return Difference<Derived1, Derived2>(mat1.ref(), mat2.ref());
} }
@ -75,7 +75,7 @@ operator-(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
Object<Scalar, Derived>::operator-=(const Object<Scalar, OtherDerived> &other) MatrixBase<Scalar, Derived>::operator-=(const MatrixBase<Scalar, OtherDerived> &other)
{ {
return *this = *this - other; return *this = *this - other;
} }

View File

@ -58,7 +58,7 @@ struct DotUnroller<Index, Dynamic, Derived1, Derived2>
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Scalar Object<Scalar, Derived>::dot(const OtherDerived& other) const Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
{ {
assert(IsVector && OtherDerived::IsVector && size() == other.size()); assert(IsVector && OtherDerived::IsVector && size() == other.size());
Scalar res; Scalar res;
@ -75,19 +75,19 @@ Scalar Object<Scalar, Derived>::dot(const OtherDerived& other) const
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
typename NumTraits<Scalar>::Real Object<Scalar, Derived>::norm2() const typename NumTraits<Scalar>::Real MatrixBase<Scalar, Derived>::norm2() const
{ {
return NumTraits<Scalar>::real(dot(*this)); return NumTraits<Scalar>::real(dot(*this));
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
typename NumTraits<Scalar>::Real Object<Scalar, Derived>::norm() const typename NumTraits<Scalar>::Real MatrixBase<Scalar, Derived>::norm() const
{ {
return std::sqrt(norm2()); return std::sqrt(norm2());
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
ScalarMultiple<Derived> Object<Scalar, Derived>::normalized() const ScalarMultiple<Derived> MatrixBase<Scalar, Derived>::normalized() const
{ {
return (*this) / norm(); return (*this) / norm();
} }

View File

@ -35,7 +35,7 @@ template<typename Expression> class Eval
typedef typename Expression::Scalar Scalar; typedef typename Expression::Scalar Scalar;
typedef Matrix<Scalar, Expression::RowsAtCompileTime, Expression::ColsAtCompileTime> MatrixType; typedef Matrix<Scalar, Expression::RowsAtCompileTime, Expression::ColsAtCompileTime> MatrixType;
typedef Expression Base; typedef Expression Base;
friend class Object<Scalar, Expression>; friend class MatrixBase<Scalar, Expression>;
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Eval) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Eval)
@ -43,7 +43,7 @@ template<typename Expression> class Eval
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Eval<Derived> Object<Scalar, Derived>::eval() const Eval<Derived> MatrixBase<Scalar, Derived>::eval() const
{ {
return Eval<Derived>(*static_cast<const Derived*>(this)); return Eval<Derived>(*static_cast<const Derived*>(this));
} }

View File

@ -27,11 +27,11 @@
#define EIGEN_FROMARRAY_H #define EIGEN_FROMARRAY_H
template<typename MatrixType> class FromArray template<typename MatrixType> class FromArray
: public Object<typename MatrixType::Scalar, FromArray<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, FromArray<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class Object<Scalar, FromArray<MatrixType> >; friend class MatrixBase<Scalar, FromArray<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -65,7 +65,7 @@ template<typename MatrixType> class FromArray
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
FromArray<Derived> Object<Scalar, Derived>::fromArray(const Scalar* array, int rows, int cols) FromArray<Derived> MatrixBase<Scalar, Derived>::fromArray(const Scalar* array, int rows, int cols)
{ {
return FromArray<Derived>(rows, cols, const_cast<Scalar*>(array)); return FromArray<Derived>(rows, cols, const_cast<Scalar*>(array));
} }

View File

@ -28,7 +28,7 @@
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
bool Object<Scalar, Derived>::isApprox( bool MatrixBase<Scalar, Derived>::isApprox(
const OtherDerived& other, const OtherDerived& other,
const typename NumTraits<Scalar>::Real& prec const typename NumTraits<Scalar>::Real& prec
) const ) const
@ -49,7 +49,7 @@ bool Object<Scalar, Derived>::isApprox(
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
bool Object<Scalar, Derived>::isMuchSmallerThan( bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(
const Scalar& other, const Scalar& other,
const typename NumTraits<Scalar>::Real& prec const typename NumTraits<Scalar>::Real& prec
) const ) const
@ -69,8 +69,8 @@ bool Object<Scalar, Derived>::isMuchSmallerThan(
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
bool Object<Scalar, Derived>::isMuchSmallerThan( bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(
const Object<Scalar, OtherDerived>& other, const MatrixBase<Scalar, OtherDerived>& other,
const typename NumTraits<Scalar>::Real& prec const typename NumTraits<Scalar>::Real& prec
) const ) const
{ {

View File

@ -27,11 +27,11 @@
#define EIGEN_IDENTITY_H #define EIGEN_IDENTITY_H
template<typename MatrixType> class Identity template<typename MatrixType> class Identity
: public Object<typename MatrixType::Scalar, Identity<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Identity<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class Object<Scalar, Identity<MatrixType> >; friend class MatrixBase<Scalar, Identity<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -61,7 +61,7 @@ template<typename MatrixType> class Identity
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Identity<Derived> Object<Scalar, Derived>::identity(int rows) Identity<Derived> MatrixBase<Scalar, Derived>::identity(int rows)
{ {
return Identity<Derived>(rows); return Identity<Derived>(rows);
} }

View File

@ -27,12 +27,12 @@
#define EIGEN_MATRIX_H #define EIGEN_MATRIX_H
template<typename _Scalar, int _Rows, int _Cols> template<typename _Scalar, int _Rows, int _Cols>
class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
public MatrixStorage<_Scalar, _Rows, _Cols> public MatrixStorage<_Scalar, _Rows, _Cols>
{ {
public: public:
friend class Object<_Scalar, Matrix>; friend class MatrixBase<_Scalar, Matrix>;
typedef Object<_Scalar, Matrix> Base; typedef MatrixBase<_Scalar, Matrix> Base;
typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage; typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage;
typedef _Scalar Scalar; typedef _Scalar Scalar;
typedef MatrixRef<Matrix> Ref; typedef MatrixRef<Matrix> Ref;
@ -63,7 +63,7 @@ class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
public: public:
template<typename OtherDerived> template<typename OtherDerived>
Matrix& operator=(const Object<Scalar, OtherDerived>& other) Matrix& operator=(const MatrixBase<Scalar, OtherDerived>& other)
{ {
resize(other.rows(), other.cols()); resize(other.rows(), other.cols());
return Base::operator=(other); return Base::operator=(other);
@ -84,7 +84,7 @@ class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
explicit Matrix(int dim) : Storage(dim) {} explicit Matrix(int dim) : Storage(dim) {}
explicit Matrix(int rows, int cols) : Storage(rows, cols) {} explicit Matrix(int rows, int cols) : Storage(rows, cols) {}
template<typename OtherDerived> template<typename OtherDerived>
Matrix(const Object<Scalar, OtherDerived>& other) Matrix(const MatrixBase<Scalar, OtherDerived>& other)
: Storage(other.rows(), other.cols()) : Storage(other.rows(), other.cols())
{ {
*this = other; *this = other;

View File

@ -26,13 +26,13 @@
#ifndef EIGEN_OBJECT_H #ifndef EIGEN_OBJECT_H
#define EIGEN_OBJECT_H #define EIGEN_OBJECT_H
template<typename Scalar, typename Derived> class Object template<typename Scalar, typename Derived> class MatrixBase
{ {
static const int RowsAtCompileTime = Derived::RowsAtCompileTime, static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
ColsAtCompileTime = Derived::ColsAtCompileTime; ColsAtCompileTime = Derived::ColsAtCompileTime;
template<typename OtherDerived> template<typename OtherDerived>
void _copy_helper(const Object<Scalar, OtherDerived>& other); void _copy_helper(const MatrixBase<Scalar, OtherDerived>& other);
template<typename OtherDerived> template<typename OtherDerived>
bool _isApprox_helper( bool _isApprox_helper(
@ -45,9 +45,10 @@ template<typename Scalar, typename Derived> class Object
) const; ) const;
template<typename OtherDerived> template<typename OtherDerived>
bool _isMuchSmallerThan_helper( bool _isMuchSmallerThan_helper(
const Object<Scalar, OtherDerived>& other, const MatrixBase<Scalar, OtherDerived>& other,
const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::precision() const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::precision()
) const; ) const;
public: public:
static const int SizeAtCompileTime static const int SizeAtCompileTime
= RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic = RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic
@ -75,7 +76,7 @@ template<typename Scalar, typename Derived> class Object
} }
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator=(const Object<Scalar, OtherDerived>& other) Derived& operator=(const MatrixBase<Scalar, OtherDerived>& other)
{ {
assert(rows() == other.rows() && cols() == other.cols()); assert(rows() == other.rows() && cols() == other.cols());
_copy_helper(other); _copy_helper(other);
@ -84,7 +85,7 @@ template<typename Scalar, typename Derived> class Object
//special case of the above template operator=. Strangely, g++ 4.1 failed to use //special case of the above template operator=. Strangely, g++ 4.1 failed to use
//that template when OtherDerived == Derived //that template when OtherDerived == Derived
Derived& operator=(const Object& other) Derived& operator=(const MatrixBase& other)
{ {
assert(rows() == other.rows() && cols() == other.cols()); assert(rows() == other.rows() && cols() == other.cols());
_copy_helper(other); _copy_helper(other);
@ -128,22 +129,22 @@ template<typename Scalar, typename Derived> class Object
) const; ) const;
template<typename OtherDerived> template<typename OtherDerived>
bool isMuchSmallerThan( bool isMuchSmallerThan(
const Object<Scalar, OtherDerived>& other, const MatrixBase<Scalar, OtherDerived>& other,
const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::precision() const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::precision()
) const; ) const;
template<typename OtherDerived> template<typename OtherDerived>
Product<Derived, OtherDerived> Product<Derived, OtherDerived>
lazyProduct(const Object<Scalar, OtherDerived>& other) const EIGEN_ALWAYS_INLINE; lazyProduct(const MatrixBase<Scalar, OtherDerived>& other) const EIGEN_ALWAYS_INLINE;
Opposite<Derived> operator-() const; Opposite<Derived> operator-() const;
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator+=(const Object<Scalar, OtherDerived>& other); Derived& operator+=(const MatrixBase<Scalar, OtherDerived>& other);
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator-=(const Object<Scalar, OtherDerived>& other); Derived& operator-=(const MatrixBase<Scalar, OtherDerived>& other);
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator*=(const Object<Scalar, OtherDerived>& other); Derived& operator*=(const MatrixBase<Scalar, OtherDerived>& other);
Derived& operator*=(const int& other); Derived& operator*=(const int& other);
Derived& operator*=(const float& other); Derived& operator*=(const float& other);
@ -183,7 +184,7 @@ template<typename Scalar, typename Derived> class Object
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
std::ostream & operator << std::ostream & operator <<
( std::ostream & s, ( std::ostream & s,
const Object<Scalar, Derived> & m ) const MatrixBase<Scalar, Derived> & m )
{ {
for( int i = 0; i < m.rows(); i++ ) for( int i = 0; i < m.rows(); i++ )
{ {

View File

@ -27,11 +27,11 @@
#define EIGEN_MATRIXREF_H #define EIGEN_MATRIXREF_H
template<typename MatrixType> class MatrixRef template<typename MatrixType> class MatrixRef
: public Object<typename MatrixType::Scalar, MatrixRef<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, MatrixRef<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class Object<Scalar, MatrixRef>; friend class MatrixBase<Scalar, MatrixRef>;
MatrixRef(const MatrixType& matrix) : m_matrix(*const_cast<MatrixType*>(&matrix)) {} MatrixRef(const MatrixType& matrix) : m_matrix(*const_cast<MatrixType*>(&matrix)) {}
MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}

View File

@ -27,12 +27,12 @@
#define EIGEN_MINOR_H #define EIGEN_MINOR_H
template<typename MatrixType> class Minor template<typename MatrixType> class Minor
: public Object<typename MatrixType::Scalar, Minor<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Minor<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Minor<MatrixType> >; friend class MatrixBase<Scalar, Minor<MatrixType> >;
static const int static const int
RowsAtCompileTime = (MatrixType::RowsAtCompileTime != Dynamic) ? RowsAtCompileTime = (MatrixType::RowsAtCompileTime != Dynamic) ?
@ -75,9 +75,9 @@ template<typename MatrixType> class Minor
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Minor<Derived> Minor<Derived>
Object<Scalar, Derived>::minor(int row, int col) const MatrixBase<Scalar, Derived>::minor(int row, int col) const
{ {
return Minor<Derived>(static_cast<Derived*>(const_cast<Object*>(this))->ref(), row, col); return Minor<Derived>(static_cast<Derived*>(const_cast<MatrixBase*>(this))->ref(), row, col);
} }
#endif // EIGEN_MINOR_H #endif // EIGEN_MINOR_H

View File

@ -27,12 +27,12 @@
#define EIGEN_OPPOSITE_H #define EIGEN_OPPOSITE_H
template<typename MatrixType> class Opposite template<typename MatrixType> class Opposite
: public Object<typename MatrixType::Scalar, Opposite<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Opposite<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Opposite<MatrixType> >; friend class MatrixBase<Scalar, Opposite<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -61,7 +61,7 @@ template<typename MatrixType> class Opposite
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Opposite<Derived> Opposite<Derived>
Object<Scalar, Derived>::operator-() const MatrixBase<Scalar, Derived>::operator-() const
{ {
return Opposite<Derived>(static_cast<const Derived*>(this)->ref()); return Opposite<Derived>(static_cast<const Derived*>(this)->ref());
} }

View File

@ -62,13 +62,13 @@ struct ProductUnroller<Index, Dynamic, Lhs, Rhs>
}; };
template<typename Lhs, typename Rhs> class Product template<typename Lhs, typename Rhs> class Product
: public Object<typename Lhs::Scalar, Product<Lhs, Rhs> > : public MatrixBase<typename Lhs::Scalar, Product<Lhs, Rhs> >
{ {
public: public:
typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Scalar Scalar;
typedef typename Lhs::Ref LhsRef; typedef typename Lhs::Ref LhsRef;
typedef typename Rhs::Ref RhsRef; typedef typename Rhs::Ref RhsRef;
friend class Object<Scalar, Product>; friend class MatrixBase<Scalar, Product>;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -113,14 +113,14 @@ template<typename Lhs, typename Rhs> class Product
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Product<Derived, OtherDerived> Product<Derived, OtherDerived>
Object<Scalar, Derived>::lazyProduct(const Object<Scalar, OtherDerived> &other) const MatrixBase<Scalar, Derived>::lazyProduct(const MatrixBase<Scalar, OtherDerived> &other) const
{ {
return Product<Derived, OtherDerived>(ref(), other.ref()); return Product<Derived, OtherDerived>(ref(), other.ref());
} }
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
Eval<Product<Derived1, Derived2> > Eval<Product<Derived1, Derived2> >
operator*(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &mat2) operator*(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{ {
return mat1.lazyProduct(mat2).eval(); return mat1.lazyProduct(mat2).eval();
} }
@ -128,7 +128,7 @@ operator*(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
Object<Scalar, Derived>::operator*=(const Object<Scalar, OtherDerived> &other) MatrixBase<Scalar, Derived>::operator*=(const MatrixBase<Scalar, OtherDerived> &other)
{ {
return *this = *this * other; return *this = *this * other;
} }

View File

@ -27,11 +27,11 @@
#define EIGEN_RANDOM_H #define EIGEN_RANDOM_H
template<typename MatrixType> class Random template<typename MatrixType> class Random
: public Object<typename MatrixType::Scalar, Random<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Random<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class Object<Scalar, Random<MatrixType> >; friend class MatrixBase<Scalar, Random<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -61,7 +61,7 @@ template<typename MatrixType> class Random
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Eval<Random<Derived> > Object<Scalar, Derived>::random(int rows, int cols) Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random(int rows, int cols)
{ {
return Random<Derived>(rows, cols).eval(); return Random<Derived>(rows, cols).eval();
} }

View File

@ -27,12 +27,12 @@
#define EIGEN_ROW_H #define EIGEN_ROW_H
template<typename MatrixType> class Row template<typename MatrixType> class Row
: public Object<typename MatrixType::Scalar, Row<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Row<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Row<MatrixType> >; friend class MatrixBase<Scalar, Row<MatrixType> >;
static const int RowsAtCompileTime = 1, static const int RowsAtCompileTime = 1,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -47,9 +47,9 @@ template<typename MatrixType> class Row
: m_matrix(other.m_matrix), m_row(other.m_row) {} : m_matrix(other.m_matrix), m_row(other.m_row) {}
template<typename OtherDerived> template<typename OtherDerived>
Row& operator=(const Object<Scalar, OtherDerived>& other) Row& operator=(const MatrixBase<Scalar, OtherDerived>& other)
{ {
return Object<Scalar, Row<MatrixType> >::operator=(other); return MatrixBase<Scalar, Row<MatrixType> >::operator=(other);
} }
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row)
@ -79,9 +79,9 @@ template<typename MatrixType> class Row
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Row<Derived> Row<Derived>
Object<Scalar, Derived>::row(int i) const MatrixBase<Scalar, Derived>::row(int i) const
{ {
return Row<Derived>(static_cast<Derived*>(const_cast<Object*>(this))->ref(), i); return Row<Derived>(static_cast<Derived*>(const_cast<MatrixBase*>(this))->ref(), i);
} }
#endif // EIGEN_ROW_H #endif // EIGEN_ROW_H

View File

@ -27,12 +27,12 @@
#define EIGEN_SCALARMULTIPLE_H #define EIGEN_SCALARMULTIPLE_H
template<typename MatrixType> class ScalarMultiple template<typename MatrixType> class ScalarMultiple
: public Object<typename MatrixType::Scalar, ScalarMultiple<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, ScalarMultiple<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<typename MatrixType::Scalar, ScalarMultiple<MatrixType> >; friend class MatrixBase<typename MatrixType::Scalar, ScalarMultiple<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -64,7 +64,7 @@ template<typename MatrixType> class ScalarMultiple
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \ #define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarMultiple<Derived> \ ScalarMultiple<Derived> \
operator*(const Object<Scalar, Derived>& matrix, \ operator*(const MatrixBase<Scalar, Derived>& matrix, \
OtherScalar scalar) \ OtherScalar scalar) \
{ \ { \
return ScalarMultiple<Derived>(matrix.ref(), scalar); \ return ScalarMultiple<Derived>(matrix.ref(), scalar); \
@ -73,14 +73,14 @@ operator*(const Object<Scalar, Derived>& matrix, \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarMultiple<Derived> \ ScalarMultiple<Derived> \
operator*(OtherScalar scalar, \ operator*(OtherScalar scalar, \
const Object<Scalar, Derived>& matrix) \ const MatrixBase<Scalar, Derived>& matrix) \
{ \ { \
return ScalarMultiple<Derived>(matrix.ref(), scalar); \ return ScalarMultiple<Derived>(matrix.ref(), scalar); \
} \ } \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarMultiple<Derived> \ ScalarMultiple<Derived> \
operator/(const Object<Scalar, Derived>& matrix, \ operator/(const MatrixBase<Scalar, Derived>& matrix, \
OtherScalar scalar) \ OtherScalar scalar) \
{ \ { \
assert(NumTraits<Scalar>::HasFloatingPoint); \ assert(NumTraits<Scalar>::HasFloatingPoint); \
@ -89,14 +89,14 @@ operator/(const Object<Scalar, Derived>& matrix, \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
Derived & \ Derived & \
Object<Scalar, Derived>::operator*=(const OtherScalar &other) \ MatrixBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
{ \ { \
return *this = *this * other; \ return *this = *this * other; \
} \ } \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
Derived & \ Derived & \
Object<Scalar, Derived>::operator/=(const OtherScalar &other) \ MatrixBase<Scalar, Derived>::operator/=(const OtherScalar &other) \
{ \ { \
return *this = *this / other; \ return *this = *this / other; \
} }

View File

@ -27,13 +27,13 @@
#define EIGEN_SUM_H #define EIGEN_SUM_H
template<typename Lhs, typename Rhs> class Sum template<typename Lhs, typename Rhs> class Sum
: public Object<typename Lhs::Scalar, Sum<Lhs, Rhs> > : public MatrixBase<typename Lhs::Scalar, Sum<Lhs, Rhs> >
{ {
public: public:
typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Scalar Scalar;
typedef typename Lhs::Ref LhsRef; typedef typename Lhs::Ref LhsRef;
typedef typename Rhs::Ref RhsRef; typedef typename Rhs::Ref RhsRef;
friend class Object<Scalar, Sum>; friend class MatrixBase<Scalar, Sum>;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -67,7 +67,7 @@ template<typename Lhs, typename Rhs> class Sum
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
Sum<Derived1, Derived2> Sum<Derived1, Derived2>
operator+(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &mat2) operator+(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{ {
return Sum<Derived1, Derived2>(mat1.ref(), mat2.ref()); return Sum<Derived1, Derived2>(mat1.ref(), mat2.ref());
} }
@ -75,7 +75,7 @@ operator+(const Object<Scalar, Derived1> &mat1, const Object<Scalar, Derived2> &
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
Object<Scalar, Derived>::operator+=(const Object<Scalar, OtherDerived>& other) MatrixBase<Scalar, Derived>::operator+=(const MatrixBase<Scalar, OtherDerived>& other)
{ {
return *this = *this + other; return *this = *this + other;
} }

View File

@ -53,7 +53,7 @@ template<int Index, typename Derived> struct TraceUnroller<Index, Dynamic, Deriv
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Scalar Object<Scalar, Derived>::trace() const Scalar MatrixBase<Scalar, Derived>::trace() const
{ {
assert(rows() == cols()); assert(rows() == cols());
Scalar res; Scalar res;

View File

@ -27,12 +27,12 @@
#define EIGEN_TRANSPOSE_H #define EIGEN_TRANSPOSE_H
template<typename MatrixType> class Transpose template<typename MatrixType> class Transpose
: public Object<typename MatrixType::Scalar, Transpose<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Transpose<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class Object<Scalar, Transpose<MatrixType> >; friend class MatrixBase<Scalar, Transpose<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime, static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime,
ColsAtCompileTime = MatrixType::RowsAtCompileTime; ColsAtCompileTime = MatrixType::RowsAtCompileTime;
@ -65,9 +65,9 @@ template<typename MatrixType> class Transpose
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Transpose<Derived> Transpose<Derived>
Object<Scalar, Derived>::transpose() const MatrixBase<Scalar, Derived>::transpose() const
{ {
return Transpose<Derived>(static_cast<Derived*>(const_cast<Object*>(this))->ref()); return Transpose<Derived>(static_cast<Derived*>(const_cast<MatrixBase*>(this))->ref());
} }
#endif // EIGEN_TRANSPOSE_H #endif // EIGEN_TRANSPOSE_H

View File

@ -88,20 +88,20 @@ const int Dynamic = -1;
#define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ #define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
template<typename OtherScalar, typename OtherDerived> \ template<typename OtherScalar, typename OtherDerived> \
Derived& operator Op(const Object<OtherScalar, OtherDerived>& other) \ Derived& operator Op(const MatrixBase<OtherScalar, OtherDerived>& other) \
{ \ { \
return Object<Scalar, Derived>::operator Op(other); \ return MatrixBase<Scalar, Derived>::operator Op(other); \
} \ } \
Derived& operator Op(const Derived& other) \ Derived& operator Op(const Derived& other) \
{ \ { \
return Object<Scalar, Derived>::operator Op(other); \ return MatrixBase<Scalar, Derived>::operator Op(other); \
} }
#define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ #define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
template<typename Other> \ template<typename Other> \
Derived& operator Op(const Other& scalar) \ Derived& operator Op(const Other& scalar) \
{ \ { \
return Object<Scalar, Derived>::operator Op(scalar); \ return MatrixBase<Scalar, Derived>::operator Op(scalar); \
} }
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \

View File

@ -27,11 +27,11 @@
#define EIGEN_ZERO_H #define EIGEN_ZERO_H
template<typename MatrixType> class Zero template<typename MatrixType> class Zero
: public Object<typename MatrixType::Scalar, Zero<MatrixType> > : public MatrixBase<typename MatrixType::Scalar, Zero<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class Object<Scalar, Zero<MatrixType> >; friend class MatrixBase<Scalar, Zero<MatrixType> >;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime; ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@ -61,7 +61,7 @@ template<typename MatrixType> class Zero
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Zero<Derived> Object<Scalar, Derived>::zero(int rows, int cols) Zero<Derived> MatrixBase<Scalar, Derived>::zero(int rows, int cols)
{ {
return Zero<Derived>(rows, cols); return Zero<Derived>(rows, cols);
} }

View File

@ -33,7 +33,7 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
Opposite.h Product.h ScalarMultiple.h FromArray.h Opposite.h Product.h ScalarMultiple.h FromArray.h
2) Implicitly (the core stuff): 2) Implicitly (the core stuff):
Object.h Matrix.h MatrixStorage.h CopyHelper.h MatrixRef.h MatrixBase.h Matrix.h MatrixStorage.h CopyHelper.h MatrixRef.h
NumTraits.h Util.h NumTraits.h Util.h
*/ */