mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Deep refactoring.
1) Kill MatrixXpr class, instead let all class inherit a common EigenBase class 2) Kill MatrixBase/Matrix/Vector classes, instead introduce a single Matrix class, a MatrixStorage class, and typedefs to emulate vectors 3) Huge code cleanup, remove large preprocessor macros, sloccount drop to ~750 down from 1100. 4) Introduce compile-time-known sizes
This commit is contained in:
@@ -30,43 +30,32 @@ namespace Eigen
|
||||
{
|
||||
|
||||
template<typename MatrixType> class MatrixRef
|
||||
: public EigenBase<typename MatrixType::Scalar, MatrixRef<MatrixType> >
|
||||
{
|
||||
public:
|
||||
typedef typename ForwardDecl<MatrixType>::Scalar Scalar;
|
||||
typedef MatrixXpr<MatrixRef<MatrixType> > Xpr;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
friend class EigenBase<Scalar, MatrixRef>;
|
||||
|
||||
MatrixRef(MatrixType& matrix) : m_matrix(matrix) {}
|
||||
MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}
|
||||
~MatrixRef() {}
|
||||
|
||||
static bool hasDynamicNumRows()
|
||||
{
|
||||
return MatrixType::hasDynamicNumRows();
|
||||
}
|
||||
INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
|
||||
|
||||
static bool hasDynamicNumCols()
|
||||
{
|
||||
return MatrixType::hasDynamicNumCols();
|
||||
}
|
||||
|
||||
int rows() const { return m_matrix.rows(); }
|
||||
int cols() const { return m_matrix.cols(); }
|
||||
private:
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
|
||||
const Scalar& read(int row, int col) const
|
||||
Scalar _read(int row, int col) const
|
||||
{
|
||||
return m_matrix.read(row, col);
|
||||
}
|
||||
|
||||
Scalar& write(int row, int col)
|
||||
Scalar& _write(int row, int col)
|
||||
{
|
||||
return m_matrix.write(row, col);
|
||||
}
|
||||
|
||||
Xpr xpr()
|
||||
{
|
||||
return Xpr(*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
MatrixType& m_matrix;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user