Half-way commit prefixing object names. I am forced to commit now

because I renamed a file once with a wrong filename and svn refuses to
let me rename it again, tells me i should propagate first.
This commit is contained in:
Benoit Jacob 2007-09-27 19:38:40 +00:00
parent 4e299afb1f
commit 5160e9d029
13 changed files with 114 additions and 119 deletions

View File

@ -12,7 +12,7 @@ int main(int, char **)
cout << "Here is a 2x2 matrix m:" << endl << m << endl; cout << "Here is a 2x2 matrix m:" << endl << m << endl;
cout << "Let us now build a 4x4 matrix m2 by assembling together four 2x2 blocks." << endl; cout << "Let us now build a 4x4 matrix m2 by assembling together four 2x2 blocks." << endl;
MatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries EiMatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries
// notice how we are mixing fixed-size and dynamic-size types. // notice how we are mixing fixed-size and dynamic-size types.
cout << "In the top-left block, we put the matrix m shown above." << endl; cout << "In the top-left block, we put the matrix m shown above." << endl;

View File

@ -26,19 +26,19 @@
#ifndef EIGEN_BLOCK_H #ifndef EIGEN_BLOCK_H
#define EIGEN_BLOCK_H #define EIGEN_BLOCK_H
template<typename MatrixType> class MatrixBlock template<typename MatrixType> class EiBlock
: public EigenBase<typename MatrixType::Scalar, MatrixBlock<MatrixType> > : public EiObject<typename MatrixType::Scalar, EiBlock<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 EigenBase<Scalar, MatrixBlock<MatrixType> >; friend class EiObject<Scalar, EiBlock<MatrixType> >;
typedef MatrixBlock Ref; typedef EiBlock Ref;
static const int RowsAtCompileTime = DynamicSize, static const int RowsAtCompileTime = EiDynamic,
ColsAtCompileTime = DynamicSize; ColsAtCompileTime = EiDynamic;
MatrixBlock(const MatRef& matrix, EiBlock(const MatRef& matrix,
int startRow, int endRow, int startRow, int endRow,
int startCol = 0, int endCol = 0) int startCol = 0, int endCol = 0)
: m_matrix(matrix), m_startRow(startRow), m_endRow(endRow), : m_matrix(matrix), m_startRow(startRow), m_endRow(endRow),
@ -48,11 +48,11 @@ template<typename MatrixType> class MatrixBlock
&& startCol >= 0 && startCol <= endCol && endCol < matrix.cols()); && startCol >= 0 && startCol <= endCol && endCol < matrix.cols());
} }
MatrixBlock(const MatrixBlock& other) EiBlock(const EiBlock& other)
: m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow), : m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow),
m_startCol(other.m_startCol), m_endCol(other.m_endCol) {} m_startCol(other.m_startCol), m_endCol(other.m_endCol) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixBlock) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(EiBlock)
private: private:
const Ref& _ref() const { return *this; } const Ref& _ref() const { return *this; }
@ -75,10 +75,10 @@ template<typename MatrixType> class MatrixBlock
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
MatrixBlock<EigenBase<Scalar, Derived> > EiBlock<EiObject<Scalar, Derived> >
EigenBase<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol) EiObject<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol)
{ {
return MatrixBlock<EigenBase>(ref(), startRow, endRow, startCol, endCol); return EiBlock<EiObject>(ref(), startRow, endRow, startCol, endCol);
} }
#endif // EIGEN_BLOCK_H #endif // EIGEN_BLOCK_H

View File

@ -28,7 +28,7 @@
#include "Util.h" #include "Util.h"
template<typename _Scalar, typename Derived> class EigenBase template<typename _Scalar, typename Derived> class EiObject
{ {
static const int RowsAtCompileTime = Derived::RowsAtCompileTime, static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
ColsAtCompileTime = Derived::ColsAtCompileTime; ColsAtCompileTime = Derived::ColsAtCompileTime;
@ -57,7 +57,7 @@ template<typename _Scalar, typename Derived> class EigenBase
} }
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator=(const EigenBase<Scalar, OtherDerived>& other) Derived& operator=(const EiObject<Scalar, OtherDerived>& other)
{ {
assert(rows() == other.rows() && cols() == other.cols()); assert(rows() == other.rows() && cols() == other.cols());
for(int i = 0; i < rows(); i++) for(int i = 0; i < rows(); i++)
@ -68,7 +68,7 @@ template<typename _Scalar, typename Derived> class EigenBase
//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 EigenBase& other) Derived& operator=(const EiObject& other)
{ {
assert(rows() == other.rows() && cols() == other.cols()); assert(rows() == other.rows() && cols() == other.cols());
for(int i = 0; i < rows(); i++) for(int i = 0; i < rows(); i++)
@ -77,18 +77,18 @@ template<typename _Scalar, typename Derived> class EigenBase
return *static_cast<Derived*>(this); return *static_cast<Derived*>(this);
} }
MatrixRow<EigenBase> row(int i); MatrixRow<EiObject> row(int i);
MatrixCol<EigenBase> col(int i); MatrixCol<EiObject> col(int i);
MatrixMinor<EigenBase> minor(int row, int col); MatrixMinor<EiObject> minor(int row, int col);
MatrixBlock<EigenBase> EiBlock<EiObject>
block(int startRow, int endRow, int startCol= 0, int endCol = 0); block(int startRow, int endRow, int startCol= 0, int endCol = 0);
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator+=(const EigenBase<Scalar, OtherDerived>& other); Derived& operator+=(const EiObject<Scalar, OtherDerived>& other);
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator-=(const EigenBase<Scalar, OtherDerived>& other); Derived& operator-=(const EiObject<Scalar, OtherDerived>& other);
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator*=(const EigenBase<Scalar, OtherDerived>& other); Derived& operator*=(const EiObject<Scalar, OtherDerived>& other);
Derived& operator*=(const int& other); Derived& operator*=(const int& other);
Derived& operator*=(const float& other); Derived& operator*=(const float& other);
@ -114,7 +114,7 @@ template<typename _Scalar, typename Derived> class EigenBase
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
std::ostream & operator << std::ostream & operator <<
( std::ostream & s, ( std::ostream & s,
const EigenBase<Scalar, Derived> & m ) const EiObject<Scalar, Derived> & m )
{ {
for( int i = 0; i < m.rows(); i++ ) for( int i = 0; i < m.rows(); i++ )
{ {

View File

@ -27,17 +27,17 @@
#define EIGEN_MATRIX_H #define EIGEN_MATRIX_H
#include "Util.h" #include "Util.h"
#include "EigenBase.h" #include "EiObject.h"
#include "MatrixRef.h" #include "MatrixRef.h"
#include "MatrixStorage.h" #include "MatrixStorage.h"
template<typename _Scalar, int _Rows, int _Cols> template<typename _Scalar, int _Rows, int _Cols>
class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
public MatrixStorage<_Scalar, _Rows, _Cols> public MatrixStorage<_Scalar, _Rows, _Cols>
{ {
public: public:
friend class EigenBase<_Scalar, Matrix>; friend class EiObject<_Scalar, Matrix>;
typedef EigenBase<_Scalar, Matrix> Base; typedef EiObject<_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;
@ -70,7 +70,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
public: public:
template<typename OtherDerived> template<typename OtherDerived>
Matrix& operator=(const EigenBase<Scalar, OtherDerived>& other) Matrix& operator=(const EiObject<Scalar, OtherDerived>& other)
{ {
resize(other.rows(), other.cols()); resize(other.rows(), other.cols());
return Base::operator=(other); return Base::operator=(other);
@ -88,7 +88,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {}
template<typename OtherDerived> template<typename OtherDerived>
Matrix(const EigenBase<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols()) Matrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols())
{ {
*this = other; *this = other;
} }
@ -101,7 +101,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>
eval(const EigenBase<Scalar, Derived>& expression) eval(const EiObject<Scalar, Derived>& expression)
{ {
return Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression); return Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression);
} }
@ -114,7 +114,7 @@ typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix;
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, DynamicSize, X) EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f)

View File

@ -26,15 +26,15 @@
#ifndef EIGEN_MATRIXOPS_H #ifndef EIGEN_MATRIXOPS_H
#define EIGEN_MATRIXOPS_H #define EIGEN_MATRIXOPS_H
template<typename Lhs, typename Rhs> class MatrixSum template<typename Lhs, typename Rhs> class EiSum
: public EigenBase<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> > : public EiObject<typename Lhs::Scalar, MatrixSum<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 EigenBase<Scalar, MatrixSum>; friend class EiObject<Scalar, MatrixSum>;
typedef MatrixSum Ref; typedef EiSum Ref;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -66,15 +66,15 @@ template<typename Lhs, typename Rhs> class MatrixSum
const RhsRef m_rhs; const RhsRef m_rhs;
}; };
template<typename Lhs, typename Rhs> class MatrixDifference template<typename Lhs, typename Rhs> class EiDifference
: public EigenBase<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> > : public EiObject<typename Lhs::Scalar, MatrixDifference<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 EigenBase<Scalar, MatrixDifference>; friend class EiObject<Scalar, MatrixDifference>;
typedef MatrixDifference Ref; typedef EiDifference Ref;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -105,15 +105,15 @@ template<typename Lhs, typename Rhs> class MatrixDifference
const RhsRef m_rhs; const RhsRef m_rhs;
}; };
template<typename Lhs, typename Rhs> class MatrixProduct template<typename Lhs, typename Rhs> class EiMatrixProduct
: public EigenBase<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> > : public EiObject<typename Lhs::Scalar, MatrixProduct<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 EigenBase<Scalar, MatrixProduct>; friend class EiObject<Scalar, MatrixProduct>;
typedef MatrixProduct Ref; typedef EiMatrixProduct Ref;
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
ColsAtCompileTime = Rhs::ColsAtCompileTime; ColsAtCompileTime = Rhs::ColsAtCompileTime;
@ -149,21 +149,21 @@ template<typename Lhs, typename Rhs> class MatrixProduct
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
MatrixSum<Derived1, Derived2> MatrixSum<Derived1, Derived2>
operator+(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) operator+(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
{ {
return MatrixSum<Derived1, Derived2>(mat1.ref(), mat2.ref()); return MatrixSum<Derived1, Derived2>(mat1.ref(), mat2.ref());
} }
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
MatrixDifference<Derived1, Derived2> MatrixDifference<Derived1, Derived2>
operator-(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) operator-(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
{ {
return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref()); return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref());
} }
template<typename Scalar, typename Derived1, typename Derived2> template<typename Scalar, typename Derived1, typename Derived2>
MatrixProduct<Derived1, Derived2> MatrixProduct<Derived1, Derived2>
operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) operator*(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
{ {
return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref()); return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref());
} }
@ -171,7 +171,7 @@ operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Deriv
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
EigenBase<Scalar, Derived>::operator+=(const EigenBase<Scalar, OtherDerived>& other) EiObject<Scalar, Derived>::operator+=(const EiObject<Scalar, OtherDerived>& other)
{ {
*this = *this + other; *this = *this + other;
return *static_cast<Derived*>(this); return *static_cast<Derived*>(this);
@ -180,7 +180,7 @@ EigenBase<Scalar, Derived>::operator+=(const EigenBase<Scalar, OtherDerived>& ot
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &other) EiObject<Scalar, Derived>::operator-=(const EiObject<Scalar, OtherDerived> &other)
{ {
*this = *this - other; *this = *this - other;
return *static_cast<Derived*>(this); return *static_cast<Derived*>(this);
@ -189,7 +189,7 @@ EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &ot
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & Derived &
EigenBase<Scalar, Derived>::operator*=(const EigenBase<Scalar, OtherDerived> &other) EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &other)
{ {
*this = *this * other; *this = *this * other;
return *static_cast<Derived*>(this); return *static_cast<Derived*>(this);

View File

@ -26,12 +26,12 @@
#ifndef EIGEN_MATRIXREF_H #ifndef EIGEN_MATRIXREF_H
#define EIGEN_MATRIXREF_H #define EIGEN_MATRIXREF_H
template<typename MatrixType> class MatrixRef template<typename MatrixType> class EiMatrixRef
: public EigenBase<typename MatrixType::Scalar, MatrixRef<MatrixType> > : public EiObject<typename MatrixType::Scalar, MatrixRef<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
friend class EigenBase<Scalar, MatrixRef>; friend class EiObject<Scalar, MatrixRef>;
MatrixRef(MatrixType& matrix) : m_matrix(matrix) {} MatrixRef(MatrixType& matrix) : m_matrix(matrix) {}
MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}

View File

@ -29,7 +29,7 @@
template<typename Scalar, template<typename Scalar,
int RowsAtCompileTime, int RowsAtCompileTime,
int ColsAtCompileTime> int ColsAtCompileTime>
class MatrixStorage class EiMatrixStorage
{ {
protected: protected:
Scalar m_array[RowsAtCompileTime * RowsAtCompileTime]; Scalar m_array[RowsAtCompileTime * RowsAtCompileTime];
@ -55,7 +55,7 @@ class MatrixStorage
}; };
template<typename Scalar> template<typename Scalar>
class MatrixStorage<Scalar, DynamicSize, 1> class MatrixStorage<Scalar, EiDynamic, 1>
{ {
protected: protected:
int m_rows; int m_rows;
@ -88,7 +88,7 @@ class MatrixStorage<Scalar, DynamicSize, 1>
}; };
template<typename Scalar> template<typename Scalar>
class MatrixStorage<Scalar, DynamicSize, DynamicSize> class MatrixStorage<Scalar, EiDynamic, EiDynamic>
{ {
protected: protected:
int m_rows, m_cols; int m_rows, m_cols;

View File

@ -26,14 +26,14 @@
#ifndef EIGEN_MINOR_H #ifndef EIGEN_MINOR_H
#define EIGEN_MINOR_H #define EIGEN_MINOR_H
template<typename MatrixType> class MatrixMinor template<typename MatrixType> class EiMinor
: public EigenBase<typename MatrixType::Scalar, MatrixMinor<MatrixType> > : public EiObject<typename MatrixType::Scalar, MatrixMinor<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 EigenBase<Scalar, MatrixMinor<MatrixType> >; friend class EiObject<Scalar, MatrixMinor<MatrixType> >;
typedef MatrixMinor Ref; typedef EiMinor Ref;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1,
ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1; ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1;
@ -71,10 +71,10 @@ template<typename MatrixType> class MatrixMinor
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
MatrixMinor<EigenBase<Scalar, Derived> > MatrixMinor<EiObject<Scalar, Derived> >
EigenBase<Scalar, Derived>::minor(int row, int col) EiObject<Scalar, Derived>::minor(int row, int col)
{ {
return MatrixMinor<EigenBase>(ref(), row, col); return MatrixMinor<EiObject>(ref(), row, col);
} }
#endif // EIGEN_MINOR_H #endif // EIGEN_MINOR_H

View File

@ -26,14 +26,14 @@
#ifndef EIGEN_ROWANDCOL_H #ifndef EIGEN_ROWANDCOL_H
#define EIGEN_ROWANDCOL_H #define EIGEN_ROWANDCOL_H
template<typename MatrixType> class MatrixRow template<typename MatrixType> class EiRow
: public EigenBase<typename MatrixType::Scalar, MatrixRow<MatrixType> > : public EiObject<typename MatrixType::Scalar, MatrixRow<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 EigenBase<Scalar, MatrixRow<MatrixType> >; friend class EiObject<Scalar, MatrixRow<MatrixType> >;
typedef MatrixRow Ref; typedef EiRow Ref;
static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime, static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime,
ColsAtCompileTime = 1; ColsAtCompileTime = 1;
@ -48,9 +48,9 @@ template<typename MatrixType> class MatrixRow
: 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>
MatrixRow& operator=(const EigenBase<Scalar, OtherDerived>& other) MatrixRow& operator=(const EiObject<Scalar, OtherDerived>& other)
{ {
return EigenBase<Scalar, MatrixRow<MatrixType> >::operator=(other); return EiObject<Scalar, MatrixRow<MatrixType> >::operator=(other);
} }
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow)
@ -81,12 +81,12 @@ template<typename MatrixType> class MatrixRow
}; };
template<typename MatrixType> class MatrixCol template<typename MatrixType> class MatrixCol
: public EigenBase<typename MatrixType::Scalar, MatrixCol<MatrixType> > : public EiObject<typename MatrixType::Scalar, MatrixCol<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 EigenBase<Scalar, MatrixCol<MatrixType> >; friend class EiObject<Scalar, MatrixCol<MatrixType> >;
typedef MatrixCol Ref; typedef MatrixCol Ref;
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
@ -128,17 +128,17 @@ template<typename MatrixType> class MatrixCol
}; };
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
MatrixRow<EigenBase<Scalar, Derived> > MatrixRow<EiObject<Scalar, Derived> >
EigenBase<Scalar, Derived>::row(int i) EiObject<Scalar, Derived>::row(int i)
{ {
return MatrixRow<EigenBase>(ref(), i); return MatrixRow<EiObject>(ref(), i);
} }
template<typename Scalar, typename Derived> template<typename Scalar, typename Derived>
MatrixCol<EigenBase<Scalar, Derived> > MatrixCol<EiObject<Scalar, Derived> >
EigenBase<Scalar, Derived>::col(int i) EiObject<Scalar, Derived>::col(int i)
{ {
return MatrixCol<EigenBase>(ref(), i); return MatrixCol<EiObject>(ref(), i);
} }
#endif // EIGEN_ROWANDCOL_H #endif // EIGEN_ROWANDCOL_H

View File

@ -26,14 +26,14 @@
#ifndef EIGEN_SCALAROPS_H #ifndef EIGEN_SCALAROPS_H
#define EIGEN_SCALAROPS_H #define EIGEN_SCALAROPS_H
template<typename MatrixType> class ScalarProduct template<typename MatrixType> class EiScalarProduct
: public EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> > : public EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >
{ {
public: public:
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
typedef ScalarProduct Ref; typedef EiScalarProduct Ref;
friend class EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> >; friend class EiObject<typename MatrixType::Scalar, ScalarProduct<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 ScalarProduct
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \ #define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarProduct<Derived> \ ScalarProduct<Derived> \
operator*(const EigenBase<Scalar, Derived>& matrix, \ operator*(const EiObject<Scalar, Derived>& matrix, \
OtherScalar scalar) \ OtherScalar scalar) \
{ \ { \
return ScalarProduct<Derived>(matrix.ref(), scalar); \ return ScalarProduct<Derived>(matrix.ref(), scalar); \
@ -73,14 +73,14 @@ operator*(const EigenBase<Scalar, Derived>& matrix, \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarProduct<Derived> \ ScalarProduct<Derived> \
operator*(OtherScalar scalar, \ operator*(OtherScalar scalar, \
const EigenBase<Scalar, Derived>& matrix) \ const EiObject<Scalar, Derived>& matrix) \
{ \ { \
return ScalarProduct<Derived>(matrix.ref(), scalar); \ return ScalarProduct<Derived>(matrix.ref(), scalar); \
} \ } \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
ScalarProduct<Derived> \ ScalarProduct<Derived> \
operator/(const EigenBase<Scalar, Derived>& matrix, \ operator/(const EiObject<Scalar, Derived>& matrix, \
OtherScalar scalar) \ OtherScalar scalar) \
{ \ { \
return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); \ return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); \
@ -88,7 +88,7 @@ operator/(const EigenBase<Scalar, Derived>& matrix, \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
Derived & \ Derived & \
EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \ EiObject<Scalar, Derived>::operator*=(const OtherScalar &other) \
{ \ { \
*this = *this * other; \ *this = *this * other; \
return *static_cast<Derived*>(this); \ return *static_cast<Derived*>(this); \
@ -96,7 +96,7 @@ EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
\ \
template<typename Scalar, typename Derived> \ template<typename Scalar, typename Derived> \
Derived & \ Derived & \
EigenBase<Scalar, Derived>::operator/=(const OtherScalar &other) \ EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \
{ \ { \
*this = *this / other; \ *this = *this / other; \
return *static_cast<Derived*>(this); \ return *static_cast<Derived*>(this); \

View File

@ -41,53 +41,48 @@
assert(col >= 0 && col < (matrix).cols()) assert(col >= 0 && col < (matrix).cols())
//forward declarations //forward declarations
template<typename _Scalar, int _Rows, int _Cols> class Matrix; template<typename _Scalar, int _Rows, int _Cols> class EiMatrix;
template<typename MatrixType> class MatrixAlias; template<typename MatrixType> class EiMatrixRef;
template<typename MatrixType> class MatrixRef; template<typename MatrixType> class EiRow;
template<typename MatrixType> class MatrixRow; template<typename MatrixType> class EiColumn;
template<typename MatrixType> class MatrixCol; template<typename MatrixType> class EiMinor;
template<typename MatrixType> class MatrixMinor; template<typename MatrixType> class EiBlock;
template<typename MatrixType> class MatrixBlock; template<typename Lhs, typename Rhs> class EiSum;
template<typename Lhs, typename Rhs> class MatrixSum; template<typename Lhs, typename Rhs> class EiDifference;
template<typename Lhs, typename Rhs> class MatrixDifference; template<typename Lhs, typename Rhs> class EiMatrixProduct;
template<typename Lhs, typename Rhs> class MatrixProduct; template<typename MatrixType> class EiScalarProduct;
template<typename MatrixType> class ScalarProduct;
template<typename T> struct ForwardDecl template<typename T> struct EiForwardDecl
{ {
typedef T Ref; typedef T Ref;
}; };
template<typename _Scalar, int _Rows, int _Cols> struct ForwardDecl<Matrix<_Scalar, _Rows, _Cols> > template<typename _Scalar, int _Rows, int _Cols>
struct EiForwardDecl<EiMatrix<_Scalar, _Rows, _Cols> >
{ {
typedef MatrixRef<Matrix<_Scalar, _Rows, _Cols> > Ref; typedef EiMatrixRef<EiMatrix<_Scalar, _Rows, _Cols> > Ref;
}; };
template<typename MatrixType> struct ForwardDecl<MatrixAlias<MatrixType> > const int EiDynamic = -1;
{
typedef MatrixRef<MatrixAlias<MatrixType> > Ref;
};
const int DynamicSize = -1;
#define EIGEN_UNUSED(x) (void)x #define EIGEN_UNUSED(x) (void)x
#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 EigenBase<OtherScalar, OtherDerived>& other) \ Derived& operator Op(const EiObject<OtherScalar, OtherDerived>& other) \
{ \ { \
return EigenBase<Scalar, Derived>::operator Op(other); \ return EiObject<Scalar, Derived>::operator Op(other); \
} \ } \
Derived& operator Op(const Derived& other) \ Derived& operator Op(const Derived& other) \
{ \ { \
return EigenBase<Scalar, Derived>::operator Op(other); \ return EiObject<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 EigenBase<Scalar, Derived>::operator Op(scalar); \ return EiObject<Scalar, Derived>::operator Op(scalar); \
} }
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \

View File

@ -47,7 +47,7 @@ void EigenTest::testMatrixManip()
matrixManip(Matrix<int, 2, 3>()); matrixManip(Matrix<int, 2, 3>());
matrixManip(Matrix<double, 3, 3>()); matrixManip(Matrix<double, 3, 3>());
matrixManip(Matrix<complex<float>, 4,3>()); matrixManip(Matrix<complex<float>, 4,3>());
matrixManip(MatrixXi(2, 2)); matrixManip(EiMatrixXi(2, 2));
matrixManip(MatrixXd(3, 5)); matrixManip(EiMatrixXd(3, 5));
matrixManip(MatrixXcf(4, 4)); matrixManip(EiMatrixXcf(4, 4));
} }

View File

@ -62,10 +62,10 @@ void EigenTest::testMatrixOps()
matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>()); matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>());
matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>()); matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>());
matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 3,4>()); matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 3,4>());
matrixOps(MatrixXf(1, 1), MatrixXf(1, 3)); matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3));
matrixOps(MatrixXi(2, 2), MatrixXi(2, 2)); matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2));
matrixOps(MatrixXd(3, 5), MatrixXd(5, 1)); matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1));
matrixOps(MatrixXcf(4, 4), MatrixXcf(4, 4)); matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4));
matrixOps(MatrixXd(3, 5), Matrix<double, 5, 1>()); matrixOps(EiMatrixXd(3, 5), Matrix<double, 5, 1>());
matrixOps(Matrix4cf(), MatrixXcf(4, 4)); matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4));
} }