mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-10 18:59:01 +08:00
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:
parent
4e299afb1f
commit
5160e9d029
@ -12,7 +12,7 @@ int main(int, char **)
|
||||
|
||||
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;
|
||||
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.
|
||||
|
||||
cout << "In the top-left block, we put the matrix m shown above." << endl;
|
||||
|
@ -26,19 +26,19 @@
|
||||
#ifndef EIGEN_BLOCK_H
|
||||
#define EIGEN_BLOCK_H
|
||||
|
||||
template<typename MatrixType> class MatrixBlock
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixBlock<MatrixType> >
|
||||
template<typename MatrixType> class EiBlock
|
||||
: public EiObject<typename MatrixType::Scalar, EiBlock<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
friend class EigenBase<Scalar, MatrixBlock<MatrixType> >;
|
||||
typedef MatrixBlock Ref;
|
||||
friend class EiObject<Scalar, EiBlock<MatrixType> >;
|
||||
typedef EiBlock Ref;
|
||||
|
||||
static const int RowsAtCompileTime = DynamicSize,
|
||||
ColsAtCompileTime = DynamicSize;
|
||||
static const int RowsAtCompileTime = EiDynamic,
|
||||
ColsAtCompileTime = EiDynamic;
|
||||
|
||||
MatrixBlock(const MatRef& matrix,
|
||||
EiBlock(const MatRef& matrix,
|
||||
int startRow, int endRow,
|
||||
int startCol = 0, int endCol = 0)
|
||||
: 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());
|
||||
}
|
||||
|
||||
MatrixBlock(const MatrixBlock& other)
|
||||
EiBlock(const EiBlock& other)
|
||||
: 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) {}
|
||||
|
||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixBlock)
|
||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(EiBlock)
|
||||
|
||||
private:
|
||||
const Ref& _ref() const { return *this; }
|
||||
@ -75,10 +75,10 @@ template<typename MatrixType> class MatrixBlock
|
||||
};
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
MatrixBlock<EigenBase<Scalar, Derived> >
|
||||
EigenBase<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol)
|
||||
EiBlock<EiObject<Scalar, Derived> >
|
||||
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
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "Util.h"
|
||||
|
||||
template<typename _Scalar, typename Derived> class EigenBase
|
||||
template<typename _Scalar, typename Derived> class EiObject
|
||||
{
|
||||
static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
|
||||
ColsAtCompileTime = Derived::ColsAtCompileTime;
|
||||
@ -57,7 +57,7 @@ template<typename _Scalar, typename Derived> class EigenBase
|
||||
}
|
||||
|
||||
template<typename OtherDerived>
|
||||
Derived& operator=(const EigenBase<Scalar, OtherDerived>& other)
|
||||
Derived& operator=(const EiObject<Scalar, OtherDerived>& other)
|
||||
{
|
||||
assert(rows() == other.rows() && cols() == other.cols());
|
||||
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
|
||||
//that template when OtherDerived == Derived
|
||||
Derived& operator=(const EigenBase& other)
|
||||
Derived& operator=(const EiObject& other)
|
||||
{
|
||||
assert(rows() == other.rows() && cols() == other.cols());
|
||||
for(int i = 0; i < rows(); i++)
|
||||
@ -77,18 +77,18 @@ template<typename _Scalar, typename Derived> class EigenBase
|
||||
return *static_cast<Derived*>(this);
|
||||
}
|
||||
|
||||
MatrixRow<EigenBase> row(int i);
|
||||
MatrixCol<EigenBase> col(int i);
|
||||
MatrixMinor<EigenBase> minor(int row, int col);
|
||||
MatrixBlock<EigenBase>
|
||||
MatrixRow<EiObject> row(int i);
|
||||
MatrixCol<EiObject> col(int i);
|
||||
MatrixMinor<EiObject> minor(int row, int col);
|
||||
EiBlock<EiObject>
|
||||
block(int startRow, int endRow, int startCol= 0, int endCol = 0);
|
||||
|
||||
template<typename OtherDerived>
|
||||
Derived& operator+=(const EigenBase<Scalar, OtherDerived>& other);
|
||||
Derived& operator+=(const EiObject<Scalar, OtherDerived>& other);
|
||||
template<typename OtherDerived>
|
||||
Derived& operator-=(const EigenBase<Scalar, OtherDerived>& other);
|
||||
Derived& operator-=(const EiObject<Scalar, OtherDerived>& other);
|
||||
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 float& other);
|
||||
@ -114,7 +114,7 @@ template<typename _Scalar, typename Derived> class EigenBase
|
||||
template<typename Scalar, typename Derived>
|
||||
std::ostream & operator <<
|
||||
( std::ostream & s,
|
||||
const EigenBase<Scalar, Derived> & m )
|
||||
const EiObject<Scalar, Derived> & m )
|
||||
{
|
||||
for( int i = 0; i < m.rows(); i++ )
|
||||
{
|
@ -27,17 +27,17 @@
|
||||
#define EIGEN_MATRIX_H
|
||||
|
||||
#include "Util.h"
|
||||
#include "EigenBase.h"
|
||||
#include "EiObject.h"
|
||||
#include "MatrixRef.h"
|
||||
#include "MatrixStorage.h"
|
||||
|
||||
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:
|
||||
friend class EigenBase<_Scalar, Matrix>;
|
||||
typedef EigenBase<_Scalar, Matrix> Base;
|
||||
friend class EiObject<_Scalar, Matrix>;
|
||||
typedef EiObject<_Scalar, Matrix> Base;
|
||||
typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage;
|
||||
typedef _Scalar Scalar;
|
||||
typedef MatrixRef<Matrix> Ref;
|
||||
@ -70,7 +70,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
||||
|
||||
public:
|
||||
template<typename OtherDerived>
|
||||
Matrix& operator=(const EigenBase<Scalar, OtherDerived>& other)
|
||||
Matrix& operator=(const EiObject<Scalar, OtherDerived>& other)
|
||||
{
|
||||
resize(other.rows(), other.cols());
|
||||
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) {}
|
||||
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;
|
||||
}
|
||||
@ -101,7 +101,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
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);
|
||||
}
|
||||
@ -114,7 +114,7 @@ typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix;
|
||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
|
||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
|
||||
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(float, f)
|
||||
|
@ -26,15 +26,15 @@
|
||||
#ifndef EIGEN_MATRIXOPS_H
|
||||
#define EIGEN_MATRIXOPS_H
|
||||
|
||||
template<typename Lhs, typename Rhs> class MatrixSum
|
||||
: public EigenBase<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> >
|
||||
template<typename Lhs, typename Rhs> class EiSum
|
||||
: public EiObject<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> >
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
friend class EigenBase<Scalar, MatrixSum>;
|
||||
typedef MatrixSum Ref;
|
||||
friend class EiObject<Scalar, MatrixSum>;
|
||||
typedef EiSum Ref;
|
||||
|
||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||
@ -66,15 +66,15 @@ template<typename Lhs, typename Rhs> class MatrixSum
|
||||
const RhsRef m_rhs;
|
||||
};
|
||||
|
||||
template<typename Lhs, typename Rhs> class MatrixDifference
|
||||
: public EigenBase<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> >
|
||||
template<typename Lhs, typename Rhs> class EiDifference
|
||||
: public EiObject<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> >
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
friend class EigenBase<Scalar, MatrixDifference>;
|
||||
typedef MatrixDifference Ref;
|
||||
friend class EiObject<Scalar, MatrixDifference>;
|
||||
typedef EiDifference Ref;
|
||||
|
||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||
@ -105,15 +105,15 @@ template<typename Lhs, typename Rhs> class MatrixDifference
|
||||
const RhsRef m_rhs;
|
||||
};
|
||||
|
||||
template<typename Lhs, typename Rhs> class MatrixProduct
|
||||
: public EigenBase<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> >
|
||||
template<typename Lhs, typename Rhs> class EiMatrixProduct
|
||||
: public EiObject<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> >
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
friend class EigenBase<Scalar, MatrixProduct>;
|
||||
typedef MatrixProduct Ref;
|
||||
friend class EiObject<Scalar, MatrixProduct>;
|
||||
typedef EiMatrixProduct Ref;
|
||||
|
||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||
@ -149,21 +149,21 @@ template<typename Lhs, typename Rhs> class MatrixProduct
|
||||
|
||||
template<typename Scalar, typename Derived1, typename 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());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived1, typename 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());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived1, typename 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());
|
||||
}
|
||||
@ -171,7 +171,7 @@ operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Deriv
|
||||
template<typename Scalar, typename Derived>
|
||||
template<typename OtherDerived>
|
||||
Derived &
|
||||
EigenBase<Scalar, Derived>::operator+=(const EigenBase<Scalar, OtherDerived>& other)
|
||||
EiObject<Scalar, Derived>::operator+=(const EiObject<Scalar, OtherDerived>& other)
|
||||
{
|
||||
*this = *this + other;
|
||||
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 OtherDerived>
|
||||
Derived &
|
||||
EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &other)
|
||||
EiObject<Scalar, Derived>::operator-=(const EiObject<Scalar, OtherDerived> &other)
|
||||
{
|
||||
*this = *this - other;
|
||||
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 OtherDerived>
|
||||
Derived &
|
||||
EigenBase<Scalar, Derived>::operator*=(const EigenBase<Scalar, OtherDerived> &other)
|
||||
EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &other)
|
||||
{
|
||||
*this = *this * other;
|
||||
return *static_cast<Derived*>(this);
|
||||
|
@ -26,12 +26,12 @@
|
||||
#ifndef EIGEN_MATRIXREF_H
|
||||
#define EIGEN_MATRIXREF_H
|
||||
|
||||
template<typename MatrixType> class MatrixRef
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixRef<MatrixType> >
|
||||
template<typename MatrixType> class EiMatrixRef
|
||||
: public EiObject<typename MatrixType::Scalar, MatrixRef<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
friend class EigenBase<Scalar, MatrixRef>;
|
||||
friend class EiObject<Scalar, MatrixRef>;
|
||||
|
||||
MatrixRef(MatrixType& matrix) : m_matrix(matrix) {}
|
||||
MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}
|
||||
|
@ -29,7 +29,7 @@
|
||||
template<typename Scalar,
|
||||
int RowsAtCompileTime,
|
||||
int ColsAtCompileTime>
|
||||
class MatrixStorage
|
||||
class EiMatrixStorage
|
||||
{
|
||||
protected:
|
||||
Scalar m_array[RowsAtCompileTime * RowsAtCompileTime];
|
||||
@ -55,7 +55,7 @@ class MatrixStorage
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
class MatrixStorage<Scalar, DynamicSize, 1>
|
||||
class MatrixStorage<Scalar, EiDynamic, 1>
|
||||
{
|
||||
protected:
|
||||
int m_rows;
|
||||
@ -88,7 +88,7 @@ class MatrixStorage<Scalar, DynamicSize, 1>
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
class MatrixStorage<Scalar, DynamicSize, DynamicSize>
|
||||
class MatrixStorage<Scalar, EiDynamic, EiDynamic>
|
||||
{
|
||||
protected:
|
||||
int m_rows, m_cols;
|
||||
|
@ -26,14 +26,14 @@
|
||||
#ifndef EIGEN_MINOR_H
|
||||
#define EIGEN_MINOR_H
|
||||
|
||||
template<typename MatrixType> class MatrixMinor
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixMinor<MatrixType> >
|
||||
template<typename MatrixType> class EiMinor
|
||||
: public EiObject<typename MatrixType::Scalar, MatrixMinor<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
friend class EigenBase<Scalar, MatrixMinor<MatrixType> >;
|
||||
typedef MatrixMinor Ref;
|
||||
friend class EiObject<Scalar, MatrixMinor<MatrixType> >;
|
||||
typedef EiMinor Ref;
|
||||
|
||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1,
|
||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1;
|
||||
@ -71,10 +71,10 @@ template<typename MatrixType> class MatrixMinor
|
||||
};
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
MatrixMinor<EigenBase<Scalar, Derived> >
|
||||
EigenBase<Scalar, Derived>::minor(int row, int col)
|
||||
MatrixMinor<EiObject<Scalar, Derived> >
|
||||
EiObject<Scalar, Derived>::minor(int row, int col)
|
||||
{
|
||||
return MatrixMinor<EigenBase>(ref(), row, col);
|
||||
return MatrixMinor<EiObject>(ref(), row, col);
|
||||
}
|
||||
|
||||
#endif // EIGEN_MINOR_H
|
||||
|
@ -26,14 +26,14 @@
|
||||
#ifndef EIGEN_ROWANDCOL_H
|
||||
#define EIGEN_ROWANDCOL_H
|
||||
|
||||
template<typename MatrixType> class MatrixRow
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixRow<MatrixType> >
|
||||
template<typename MatrixType> class EiRow
|
||||
: public EiObject<typename MatrixType::Scalar, MatrixRow<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
friend class EigenBase<Scalar, MatrixRow<MatrixType> >;
|
||||
typedef MatrixRow Ref;
|
||||
friend class EiObject<Scalar, MatrixRow<MatrixType> >;
|
||||
typedef EiRow Ref;
|
||||
|
||||
static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime,
|
||||
ColsAtCompileTime = 1;
|
||||
@ -48,9 +48,9 @@ template<typename MatrixType> class MatrixRow
|
||||
: m_matrix(other.m_matrix), m_row(other.m_row) {}
|
||||
|
||||
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)
|
||||
@ -81,12 +81,12 @@ template<typename MatrixType> class MatrixRow
|
||||
};
|
||||
|
||||
template<typename MatrixType> class MatrixCol
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixCol<MatrixType> >
|
||||
: public EiObject<typename MatrixType::Scalar, MatrixCol<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
friend class EigenBase<Scalar, MatrixCol<MatrixType> >;
|
||||
friend class EiObject<Scalar, MatrixCol<MatrixType> >;
|
||||
typedef MatrixCol Ref;
|
||||
|
||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||
@ -128,17 +128,17 @@ template<typename MatrixType> class MatrixCol
|
||||
};
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
MatrixRow<EigenBase<Scalar, Derived> >
|
||||
EigenBase<Scalar, Derived>::row(int i)
|
||||
MatrixRow<EiObject<Scalar, Derived> >
|
||||
EiObject<Scalar, Derived>::row(int i)
|
||||
{
|
||||
return MatrixRow<EigenBase>(ref(), i);
|
||||
return MatrixRow<EiObject>(ref(), i);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
MatrixCol<EigenBase<Scalar, Derived> >
|
||||
EigenBase<Scalar, Derived>::col(int i)
|
||||
MatrixCol<EiObject<Scalar, Derived> >
|
||||
EiObject<Scalar, Derived>::col(int i)
|
||||
{
|
||||
return MatrixCol<EigenBase>(ref(), i);
|
||||
return MatrixCol<EiObject>(ref(), i);
|
||||
}
|
||||
|
||||
#endif // EIGEN_ROWANDCOL_H
|
||||
|
@ -26,14 +26,14 @@
|
||||
#ifndef EIGEN_SCALAROPS_H
|
||||
#define EIGEN_SCALAROPS_H
|
||||
|
||||
template<typename MatrixType> class ScalarProduct
|
||||
: public EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> >
|
||||
template<typename MatrixType> class EiScalarProduct
|
||||
: public EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef ScalarProduct Ref;
|
||||
friend class EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> >;
|
||||
typedef EiScalarProduct Ref;
|
||||
friend class EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >;
|
||||
|
||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime;
|
||||
@ -64,7 +64,7 @@ template<typename MatrixType> class ScalarProduct
|
||||
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarProduct<Derived> \
|
||||
operator*(const EigenBase<Scalar, Derived>& matrix, \
|
||||
operator*(const EiObject<Scalar, Derived>& matrix, \
|
||||
OtherScalar scalar) \
|
||||
{ \
|
||||
return ScalarProduct<Derived>(matrix.ref(), scalar); \
|
||||
@ -73,14 +73,14 @@ operator*(const EigenBase<Scalar, Derived>& matrix, \
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarProduct<Derived> \
|
||||
operator*(OtherScalar scalar, \
|
||||
const EigenBase<Scalar, Derived>& matrix) \
|
||||
const EiObject<Scalar, Derived>& matrix) \
|
||||
{ \
|
||||
return ScalarProduct<Derived>(matrix.ref(), scalar); \
|
||||
} \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarProduct<Derived> \
|
||||
operator/(const EigenBase<Scalar, Derived>& matrix, \
|
||||
operator/(const EiObject<Scalar, Derived>& matrix, \
|
||||
OtherScalar 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> \
|
||||
Derived & \
|
||||
EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||
EiObject<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||
{ \
|
||||
*this = *this * other; \
|
||||
return *static_cast<Derived*>(this); \
|
||||
@ -96,7 +96,7 @@ EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
Derived & \
|
||||
EigenBase<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||
EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||
{ \
|
||||
*this = *this / other; \
|
||||
return *static_cast<Derived*>(this); \
|
||||
|
@ -41,53 +41,48 @@
|
||||
assert(col >= 0 && col < (matrix).cols())
|
||||
|
||||
//forward declarations
|
||||
template<typename _Scalar, int _Rows, int _Cols> class Matrix;
|
||||
template<typename MatrixType> class MatrixAlias;
|
||||
template<typename MatrixType> class MatrixRef;
|
||||
template<typename MatrixType> class MatrixRow;
|
||||
template<typename MatrixType> class MatrixCol;
|
||||
template<typename MatrixType> class MatrixMinor;
|
||||
template<typename MatrixType> class MatrixBlock;
|
||||
template<typename Lhs, typename Rhs> class MatrixSum;
|
||||
template<typename Lhs, typename Rhs> class MatrixDifference;
|
||||
template<typename Lhs, typename Rhs> class MatrixProduct;
|
||||
template<typename MatrixType> class ScalarProduct;
|
||||
template<typename _Scalar, int _Rows, int _Cols> class EiMatrix;
|
||||
template<typename MatrixType> class EiMatrixRef;
|
||||
template<typename MatrixType> class EiRow;
|
||||
template<typename MatrixType> class EiColumn;
|
||||
template<typename MatrixType> class EiMinor;
|
||||
template<typename MatrixType> class EiBlock;
|
||||
template<typename Lhs, typename Rhs> class EiSum;
|
||||
template<typename Lhs, typename Rhs> class EiDifference;
|
||||
template<typename Lhs, typename Rhs> class EiMatrixProduct;
|
||||
template<typename MatrixType> class EiScalarProduct;
|
||||
|
||||
template<typename T> struct ForwardDecl
|
||||
template<typename T> struct EiForwardDecl
|
||||
{
|
||||
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> >
|
||||
{
|
||||
typedef MatrixRef<MatrixAlias<MatrixType> > Ref;
|
||||
};
|
||||
|
||||
const int DynamicSize = -1;
|
||||
const int EiDynamic = -1;
|
||||
|
||||
#define EIGEN_UNUSED(x) (void)x
|
||||
|
||||
#define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
|
||||
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) \
|
||||
{ \
|
||||
return EigenBase<Scalar, Derived>::operator Op(other); \
|
||||
return EiObject<Scalar, Derived>::operator Op(other); \
|
||||
}
|
||||
|
||||
#define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
|
||||
template<typename Other> \
|
||||
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) \
|
||||
|
@ -47,7 +47,7 @@ void EigenTest::testMatrixManip()
|
||||
matrixManip(Matrix<int, 2, 3>());
|
||||
matrixManip(Matrix<double, 3, 3>());
|
||||
matrixManip(Matrix<complex<float>, 4,3>());
|
||||
matrixManip(MatrixXi(2, 2));
|
||||
matrixManip(MatrixXd(3, 5));
|
||||
matrixManip(MatrixXcf(4, 4));
|
||||
matrixManip(EiMatrixXi(2, 2));
|
||||
matrixManip(EiMatrixXd(3, 5));
|
||||
matrixManip(EiMatrixXcf(4, 4));
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ void EigenTest::testMatrixOps()
|
||||
matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>());
|
||||
matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>());
|
||||
matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 3,4>());
|
||||
matrixOps(MatrixXf(1, 1), MatrixXf(1, 3));
|
||||
matrixOps(MatrixXi(2, 2), MatrixXi(2, 2));
|
||||
matrixOps(MatrixXd(3, 5), MatrixXd(5, 1));
|
||||
matrixOps(MatrixXcf(4, 4), MatrixXcf(4, 4));
|
||||
matrixOps(MatrixXd(3, 5), Matrix<double, 5, 1>());
|
||||
matrixOps(Matrix4cf(), MatrixXcf(4, 4));
|
||||
matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3));
|
||||
matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2));
|
||||
matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1));
|
||||
matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4));
|
||||
matrixOps(EiMatrixXd(3, 5), Matrix<double, 5, 1>());
|
||||
matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user