mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-19 18:40:38 +08:00
renaming: ref() --> asArg()
This commit is contained in:
parent
f65cca5d1d
commit
861c6f4c9b
@ -63,7 +63,7 @@ template<typename MatrixType,
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Block>;
|
||||
friend class MatrixBase<Scalar, Block>::Traits;
|
||||
typedef MatrixBase<Scalar, Block> Base;
|
||||
@ -104,7 +104,7 @@ template<typename MatrixType,
|
||||
: (BlockCols==Dynamic ? MatrixType::Traits::MaxColsAtCompileTime : BlockCols)
|
||||
};
|
||||
|
||||
const Block& _ref() const { return *this; }
|
||||
const Block& _asArg() const { return *this; }
|
||||
int _rows() const { return m_blockRows.value(); }
|
||||
int _cols() const { return m_blockCols.value(); }
|
||||
|
||||
@ -147,7 +147,7 @@ template<typename Scalar, typename Derived>
|
||||
Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::block(int startRow, int startCol, int blockRows, int blockCols)
|
||||
{
|
||||
return Block<Derived>(ref(), startRow, startCol, blockRows, blockCols);
|
||||
return Block<Derived>(asArg(), startRow, startCol, blockRows, blockCols);
|
||||
}
|
||||
|
||||
/** This is the const version of block(int,int,int,int). */
|
||||
@ -155,7 +155,7 @@ template<typename Scalar, typename Derived>
|
||||
const Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::block(int startRow, int startCol, int blockRows, int blockCols) const
|
||||
{
|
||||
return Block<Derived>(ref(), startRow, startCol, blockRows, blockCols);
|
||||
return Block<Derived>(asArg(), startRow, startCol, blockRows, blockCols);
|
||||
}
|
||||
|
||||
/** \returns a dynamic-size expression of a block in *this.
|
||||
@ -179,7 +179,7 @@ Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::block(int start, int size)
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(), Traits::RowsAtCompileTime == 1 ? 0 : start,
|
||||
return Block<Derived>(asArg(), Traits::RowsAtCompileTime == 1 ? 0 : start,
|
||||
Traits::ColsAtCompileTime == 1 ? 0 : start,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
Traits::ColsAtCompileTime == 1 ? 1 : size);
|
||||
@ -191,7 +191,7 @@ const Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::block(int start, int size) const
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(), Traits::RowsAtCompileTime == 1 ? 0 : start,
|
||||
return Block<Derived>(asArg(), Traits::RowsAtCompileTime == 1 ? 0 : start,
|
||||
Traits::ColsAtCompileTime == 1 ? 0 : start,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
Traits::ColsAtCompileTime == 1 ? 1 : size);
|
||||
@ -217,7 +217,7 @@ Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::start(int size)
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(), 0, 0,
|
||||
return Block<Derived>(asArg(), 0, 0,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
Traits::ColsAtCompileTime == 1 ? 1 : size);
|
||||
}
|
||||
@ -228,7 +228,7 @@ const Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::start(int size) const
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(), 0, 0,
|
||||
return Block<Derived>(asArg(), 0, 0,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
Traits::ColsAtCompileTime == 1 ? 1 : size);
|
||||
}
|
||||
@ -253,7 +253,7 @@ Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::end(int size)
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(),
|
||||
return Block<Derived>(asArg(),
|
||||
Traits::RowsAtCompileTime == 1 ? 0 : rows() - size,
|
||||
Traits::ColsAtCompileTime == 1 ? 0 : cols() - size,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
@ -266,7 +266,7 @@ const Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::end(int size) const
|
||||
{
|
||||
assert(Traits::IsVectorAtCompileTime);
|
||||
return Block<Derived>(ref(),
|
||||
return Block<Derived>(asArg(),
|
||||
Traits::RowsAtCompileTime == 1 ? 0 : rows() - size,
|
||||
Traits::ColsAtCompileTime == 1 ? 0 : cols() - size,
|
||||
Traits::RowsAtCompileTime == 1 ? 1 : size,
|
||||
@ -294,13 +294,13 @@ Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::corner(CornerType type, int cRows, int cCols)
|
||||
{
|
||||
if(type == TopLeft)
|
||||
return Block<Derived>(ref(), 0, 0, cRows, cCols);
|
||||
return Block<Derived>(asArg(), 0, 0, cRows, cCols);
|
||||
else if(type == TopRight)
|
||||
return Block<Derived>(ref(), 0, cols() - cCols, cRows, cCols);
|
||||
return Block<Derived>(asArg(), 0, cols() - cCols, cRows, cCols);
|
||||
else if(type == BottomLeft)
|
||||
return Block<Derived>(ref(), rows() - cRows, 0, cRows, cCols);
|
||||
return Block<Derived>(asArg(), rows() - cRows, 0, cRows, cCols);
|
||||
else
|
||||
return Block<Derived>(ref(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
return Block<Derived>(asArg(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
}
|
||||
|
||||
/** This is the const version of corner(CornerType, int, int).*/
|
||||
@ -309,13 +309,13 @@ const Block<Derived> MatrixBase<Scalar, Derived>
|
||||
::corner(CornerType type, int cRows, int cCols) const
|
||||
{
|
||||
if(type == TopLeft)
|
||||
return Block<Derived>(ref(), 0, 0, cRows, cCols);
|
||||
return Block<Derived>(asArg(), 0, 0, cRows, cCols);
|
||||
else if(type == TopRight)
|
||||
return Block<Derived>(ref(), 0, cols() - cCols, cRows, cCols);
|
||||
return Block<Derived>(asArg(), 0, cols() - cCols, cRows, cCols);
|
||||
else if(type == BottomLeft)
|
||||
return Block<Derived>(ref(), rows() - cRows, 0, cRows, cCols);
|
||||
return Block<Derived>(asArg(), rows() - cRows, 0, cRows, cCols);
|
||||
else
|
||||
return Block<Derived>(ref(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
return Block<Derived>(asArg(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
}
|
||||
|
||||
/** \returns a fixed-size expression of a block in *this.
|
||||
@ -339,7 +339,7 @@ template<int BlockRows, int BlockCols>
|
||||
Block<Derived, BlockRows, BlockCols> MatrixBase<Scalar, Derived>
|
||||
::block(int startRow, int startCol)
|
||||
{
|
||||
return Block<Derived, BlockRows, BlockCols>(ref(), startRow, startCol);
|
||||
return Block<Derived, BlockRows, BlockCols>(asArg(), startRow, startCol);
|
||||
}
|
||||
|
||||
/** This is the const version of block<>(int, int). */
|
||||
@ -348,7 +348,7 @@ template<int BlockRows, int BlockCols>
|
||||
const Block<Derived, BlockRows, BlockCols> MatrixBase<Scalar, Derived>
|
||||
::block(int startRow, int startCol) const
|
||||
{
|
||||
return Block<Derived, BlockRows, BlockCols>(ref(), startRow, startCol);
|
||||
return Block<Derived, BlockRows, BlockCols>(asArg(), startRow, startCol);
|
||||
}
|
||||
|
||||
#endif // EIGEN_BLOCK_H
|
||||
|
@ -50,7 +50,7 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef NewScalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Cast>;
|
||||
friend class MatrixBase<Scalar, Cast>::Traits;
|
||||
typedef MatrixBase<Scalar, Cast> Base;
|
||||
@ -64,7 +64,7 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
|
||||
MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
const Cast& _ref() const { return *this; }
|
||||
const Cast& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
|
||||
@ -92,7 +92,7 @@ template<typename NewScalar>
|
||||
const Cast<NewScalar, Derived>
|
||||
MatrixBase<Scalar, Derived>::cast() const
|
||||
{
|
||||
return Cast<NewScalar, Derived>(ref());
|
||||
return Cast<NewScalar, Derived>(asArg());
|
||||
}
|
||||
|
||||
#endif // EIGEN_CAST_H
|
||||
|
@ -50,7 +50,7 @@ template<typename MatrixType> class Column
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Column>;
|
||||
friend class MatrixBase<Scalar, Column>::Traits;
|
||||
typedef MatrixBase<Scalar, Column> Base;
|
||||
@ -71,7 +71,7 @@ template<typename MatrixType> class Column
|
||||
MaxColsAtCompileTime = 1
|
||||
};
|
||||
|
||||
const Column& _ref() const { return *this; }
|
||||
const Column& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return 1; }
|
||||
|
||||
@ -100,7 +100,7 @@ template<typename Scalar, typename Derived>
|
||||
Column<Derived>
|
||||
MatrixBase<Scalar, Derived>::col(int i)
|
||||
{
|
||||
return Column<Derived>(ref(), i);
|
||||
return Column<Derived>(asArg(), i);
|
||||
}
|
||||
|
||||
/** This is the const version of col(). */
|
||||
@ -108,7 +108,7 @@ template<typename Scalar, typename Derived>
|
||||
const Column<Derived>
|
||||
MatrixBase<Scalar, Derived>::col(int i) const
|
||||
{
|
||||
return Column<Derived>(ref(), i);
|
||||
return Column<Derived>(asArg(), i);
|
||||
}
|
||||
|
||||
#endif // EIGEN_COLUMN_H
|
||||
|
@ -52,8 +52,8 @@ class CwiseBinaryOp : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
typedef typename Lhs::AsArg LhsRef;
|
||||
typedef typename Rhs::AsArg RhsRef;
|
||||
friend class MatrixBase<Scalar, CwiseBinaryOp>;
|
||||
friend class MatrixBase<Scalar, CwiseBinaryOp>::Traits;
|
||||
typedef MatrixBase<Scalar, CwiseBinaryOp> Base;
|
||||
@ -72,7 +72,7 @@ class CwiseBinaryOp : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = Lhs::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const CwiseBinaryOp& _ref() const { return *this; }
|
||||
const CwiseBinaryOp& _asArg() const { return *this; }
|
||||
int _rows() const { return m_lhs.rows(); }
|
||||
int _cols() const { return m_lhs.cols(); }
|
||||
|
||||
@ -128,7 +128,7 @@ template<typename Scalar, typename Derived1, typename Derived2>
|
||||
const CwiseBinaryOp<CwiseDifferenceOp, Derived1, Derived2>
|
||||
operator-(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return CwiseBinaryOp<CwiseDifferenceOp, Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
return CwiseBinaryOp<CwiseDifferenceOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
|
||||
}
|
||||
|
||||
/** replaces \c *this by \c *this - \a other.
|
||||
@ -154,7 +154,7 @@ template<typename Scalar, typename Derived1, typename Derived2>
|
||||
const CwiseBinaryOp<CwiseSumOp, Derived1, Derived2>
|
||||
operator+(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return CwiseBinaryOp<CwiseSumOp, Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
return CwiseBinaryOp<CwiseSumOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
|
||||
}
|
||||
|
||||
/** replaces \c *this by \c *this + \a other.
|
||||
@ -179,7 +179,7 @@ template<typename OtherDerived>
|
||||
const CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived>
|
||||
MatrixBase<Scalar, Derived>::cwiseProduct(const MatrixBase<Scalar, OtherDerived> &other) const
|
||||
{
|
||||
return CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived>(ref(), other.ref());
|
||||
return CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived>(asArg(), other.asArg());
|
||||
}
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ template<typename OtherDerived>
|
||||
const CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived>
|
||||
MatrixBase<Scalar, Derived>::cwiseQuotient(const MatrixBase<Scalar, OtherDerived> &other) const
|
||||
{
|
||||
return CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived>(ref(), other.ref());
|
||||
return CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived>(asArg(), other.asArg());
|
||||
}
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ template<typename CustomBinaryOp, typename Scalar, typename Derived1, typename D
|
||||
const CwiseBinaryOp<CustomBinaryOp, Derived1, Derived2>
|
||||
cwise(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return CwiseBinaryOp<CustomBinaryOp, Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
return CwiseBinaryOp<CustomBinaryOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
|
||||
}
|
||||
|
||||
/** \returns an expression of a custom coefficient-wise operator of *this and \a other
|
||||
@ -232,7 +232,7 @@ template<typename CustomBinaryOp, typename OtherDerived>
|
||||
const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>
|
||||
MatrixBase<Scalar, Derived>::cwise(const MatrixBase<Scalar, OtherDerived> &other) const
|
||||
{
|
||||
return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(ref(), other.ref());
|
||||
return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(asArg(), other.asArg());
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ class CwiseUnaryOp : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, CwiseUnaryOp>;
|
||||
friend class MatrixBase<Scalar, CwiseUnaryOp>::Traits;
|
||||
typedef MatrixBase<Scalar, CwiseUnaryOp> Base;
|
||||
@ -60,7 +60,7 @@ class CwiseUnaryOp : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const CwiseUnaryOp& _ref() const { return *this; }
|
||||
const CwiseUnaryOp& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
|
||||
@ -96,7 +96,7 @@ template<typename Scalar, typename Derived>
|
||||
const CwiseUnaryOp<ScalarOppositeOp,Derived>
|
||||
MatrixBase<Scalar, Derived>::operator-() const
|
||||
{
|
||||
return CwiseUnaryOp<ScalarOppositeOp,Derived>(ref());
|
||||
return CwiseUnaryOp<ScalarOppositeOp,Derived>(asArg());
|
||||
}
|
||||
|
||||
/** \returns an expression of the opposite of \c *this
|
||||
@ -105,7 +105,7 @@ template<typename Scalar, typename Derived>
|
||||
const CwiseUnaryOp<ScalarAbsOp,Derived>
|
||||
MatrixBase<Scalar, Derived>::cwiseAbs() const
|
||||
{
|
||||
return CwiseUnaryOp<ScalarAbsOp,Derived>(ref());
|
||||
return CwiseUnaryOp<ScalarAbsOp,Derived>(asArg());
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ template<typename CustomUnaryOp, typename Scalar, typename Derived>
|
||||
const CwiseUnaryOp<CustomUnaryOp, Derived>
|
||||
cwise(const MatrixBase<Scalar, Derived> &mat)
|
||||
{
|
||||
return CwiseUnaryOp<CustomUnaryOp, Derived>(mat.ref());
|
||||
return CwiseUnaryOp<CustomUnaryOp, Derived>(mat.asArg());
|
||||
}
|
||||
|
||||
/** \returns an expression of a custom coefficient-wise unary operator of *this
|
||||
@ -145,7 +145,7 @@ template<typename CustomUnaryOp>
|
||||
const CwiseUnaryOp<CustomUnaryOp, Derived>
|
||||
MatrixBase<Scalar, Derived>::cwise() const
|
||||
{
|
||||
return CwiseUnaryOp<CustomUnaryOp, Derived>(ref());
|
||||
return CwiseUnaryOp<CustomUnaryOp, Derived>(asArg());
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ template<typename Scalar, typename Derived>
|
||||
const CwiseUnaryOp<ScalarConjugateOp, Derived>
|
||||
MatrixBase<Scalar, Derived>::conjugate() const
|
||||
{
|
||||
return CwiseUnaryOp<ScalarConjugateOp, Derived>(ref());
|
||||
return CwiseUnaryOp<ScalarConjugateOp, Derived>(asArg());
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ template<typename MatrixType> class DiagonalCoeffs
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, DiagonalCoeffs>;
|
||||
friend class MatrixBase<Scalar, DiagonalCoeffs>::Traits;
|
||||
typedef MatrixBase<Scalar, DiagonalCoeffs> Base;
|
||||
@ -63,7 +63,7 @@ template<typename MatrixType> class DiagonalCoeffs
|
||||
MaxColsAtCompileTime = 1
|
||||
};
|
||||
|
||||
const DiagonalCoeffs& _ref() const { return *this; }
|
||||
const DiagonalCoeffs& _asArg() const { return *this; }
|
||||
int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); }
|
||||
int _cols() const { return 1; }
|
||||
|
||||
@ -91,7 +91,7 @@ template<typename Scalar, typename Derived>
|
||||
DiagonalCoeffs<Derived>
|
||||
MatrixBase<Scalar, Derived>::diagonal()
|
||||
{
|
||||
return DiagonalCoeffs<Derived>(ref());
|
||||
return DiagonalCoeffs<Derived>(asArg());
|
||||
}
|
||||
|
||||
/** This is the const version of diagonal(). */
|
||||
@ -99,7 +99,7 @@ template<typename Scalar, typename Derived>
|
||||
const DiagonalCoeffs<Derived>
|
||||
MatrixBase<Scalar, Derived>::diagonal() const
|
||||
{
|
||||
return DiagonalCoeffs<Derived>(ref());
|
||||
return DiagonalCoeffs<Derived>(asArg());
|
||||
}
|
||||
|
||||
#endif // EIGEN_DIAGONALCOEFFS_H
|
||||
|
@ -45,7 +45,7 @@ class DiagonalMatrix : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef typename CoeffsVectorType::Scalar Scalar;
|
||||
typedef typename CoeffsVectorType::Ref CoeffsVecRef;
|
||||
typedef typename CoeffsVectorType::AsArg CoeffsVecRef;
|
||||
friend class MatrixBase<Scalar, DiagonalMatrix>;
|
||||
friend class MatrixBase<Scalar, DiagonalMatrix>::Traits;
|
||||
typedef MatrixBase<Scalar, DiagonalMatrix> Base;
|
||||
@ -64,7 +64,7 @@ class DiagonalMatrix : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = CoeffsVectorType::Traits::MaxSizeAtCompileTime
|
||||
};
|
||||
|
||||
const DiagonalMatrix& _ref() const { return *this; }
|
||||
const DiagonalMatrix& _asArg() const { return *this; }
|
||||
int _rows() const { return m_coeffs.size(); }
|
||||
int _cols() const { return m_coeffs.size(); }
|
||||
|
||||
@ -90,7 +90,7 @@ template<typename Scalar, typename Derived>
|
||||
const DiagonalMatrix<Derived>
|
||||
MatrixBase<Scalar, Derived>::asDiagonal() const
|
||||
{
|
||||
return DiagonalMatrix<Derived>(ref());
|
||||
return DiagonalMatrix<Derived>(asArg());
|
||||
}
|
||||
|
||||
/** \returns true if *this is approximately equal to a diagonal matrix,
|
||||
|
@ -56,7 +56,7 @@ template<typename MatrixType> class Identity : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Identity& _ref() const { return *this; }
|
||||
const Identity& _asArg() const { return *this; }
|
||||
int _rows() const { return m_rows.value(); }
|
||||
int _cols() const { return m_cols.value(); }
|
||||
|
||||
|
@ -56,7 +56,7 @@ template<typename MatrixType> class Map
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Map& _ref() const { return *this; }
|
||||
const Map& _asArg() const { return *this; }
|
||||
int _rows() const { return m_rows; }
|
||||
int _cols() const { return m_cols; }
|
||||
|
||||
|
@ -84,7 +84,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols,
|
||||
|
||||
typedef MatrixBase<_Scalar, Matrix> Base;
|
||||
typedef _Scalar Scalar;
|
||||
typedef MatrixRef<Matrix> Ref;
|
||||
typedef MatrixRef<Matrix> AsArg;
|
||||
friend class MatrixRef<Matrix>;
|
||||
|
||||
private:
|
||||
@ -101,7 +101,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols,
|
||||
|
||||
MatrixStorage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage;
|
||||
|
||||
Ref _ref() const { return Ref(*this); }
|
||||
AsArg _asArg() const { return AsArg(*this); }
|
||||
int _rows() const { return m_storage.rows(); }
|
||||
int _cols() const { return m_storage.cols(); }
|
||||
|
||||
|
@ -125,13 +125,13 @@ template<typename Scalar, typename Derived> class MatrixBase
|
||||
};
|
||||
|
||||
/** This is the "reference type" used to pass objects of type MatrixBase as arguments
|
||||
* to functions. If this MatrixBase type represents an expression, then \a Ref
|
||||
* to functions. If this MatrixBase type represents an expression, then \a AsArg
|
||||
* is just this MatrixBase type itself, i.e. expressions are just passed by value
|
||||
* and the compiler is usually clever enough to optimize that. If, on the
|
||||
* other hand, this MatrixBase type is an actual matrix or vector type, then \a Ref is
|
||||
* other hand, this MatrixBase type is an actual matrix or vector type, then \a AsArg is
|
||||
* a typedef to MatrixRef, which works as a reference, so that matrices and vectors
|
||||
* are passed by reference, not by value. \sa ref()*/
|
||||
typedef typename Reference<Derived>::Type Ref;
|
||||
* are passed by reference, not by value. \sa asArg()*/
|
||||
typedef typename Reference<Derived>::Type AsArg;
|
||||
|
||||
/** This is the "real scalar" type; if the \a Scalar type is already real numbers
|
||||
* (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If
|
||||
@ -160,9 +160,9 @@ template<typename Scalar, typename Derived> class MatrixBase
|
||||
bool isVector() const { return rows()==1 || cols()==1; }
|
||||
//@}
|
||||
|
||||
/** \returns a Ref to *this. \sa Ref */
|
||||
Ref ref() const
|
||||
{ return static_cast<const Derived *>(this)->_ref(); }
|
||||
/** \returns a AsArg to *this. \sa AsArg */
|
||||
AsArg asArg() const
|
||||
{ return static_cast<const Derived *>(this)->_asArg(); }
|
||||
|
||||
//@{
|
||||
/** Copies \a other into *this. \returns a reference to *this. */
|
||||
|
@ -47,7 +47,7 @@ template<typename MatrixType> class MatrixRef
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
MatrixRef _ref() const { return *this; }
|
||||
MatrixRef _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
|
||||
|
@ -42,7 +42,7 @@ template<typename MatrixType> class Minor
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Minor>;
|
||||
friend class MatrixBase<Scalar, Minor>::Traits;
|
||||
typedef MatrixBase<Scalar, Minor> Base;
|
||||
@ -69,7 +69,7 @@ template<typename MatrixType> class Minor
|
||||
MatrixType::Traits::MaxColsAtCompileTime - 1 : Dynamic
|
||||
};
|
||||
|
||||
const Minor& _ref() const { return *this; }
|
||||
const Minor& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows() - 1; }
|
||||
int _cols() const { return m_matrix.cols() - 1; }
|
||||
|
||||
@ -101,7 +101,7 @@ template<typename Scalar, typename Derived>
|
||||
Minor<Derived>
|
||||
MatrixBase<Scalar, Derived>::minor(int row, int col)
|
||||
{
|
||||
return Minor<Derived>(ref(), row, col);
|
||||
return Minor<Derived>(asArg(), row, col);
|
||||
}
|
||||
|
||||
/** This is the const version of minor(). */
|
||||
@ -109,7 +109,7 @@ template<typename Scalar, typename Derived>
|
||||
const Minor<Derived>
|
||||
MatrixBase<Scalar, Derived>::minor(int row, int col) const
|
||||
{
|
||||
return Minor<Derived>(ref(), row, col);
|
||||
return Minor<Derived>(asArg(), row, col);
|
||||
}
|
||||
|
||||
#endif // EIGEN_MINOR_H
|
||||
|
@ -49,7 +49,7 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Ones& _ref() const { return *this; }
|
||||
const Ones& _asArg() const { return *this; }
|
||||
int _rows() const { return m_rows.value(); }
|
||||
int _cols() const { return m_cols.value(); }
|
||||
|
||||
|
@ -77,8 +77,8 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
typedef typename Lhs::AsArg LhsRef;
|
||||
typedef typename Rhs::AsArg RhsRef;
|
||||
friend class MatrixBase<Scalar, Product>;
|
||||
friend class MatrixBase<Scalar, Product>::Traits;
|
||||
typedef MatrixBase<Scalar, Product> Base;
|
||||
@ -97,7 +97,7 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = Rhs::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Product& _ref() const { return *this; }
|
||||
const Product& _asArg() const { return *this; }
|
||||
int _rows() const { return m_lhs.rows(); }
|
||||
int _cols() const { return m_rhs.cols(); }
|
||||
|
||||
@ -138,7 +138,7 @@ template<typename OtherDerived>
|
||||
const Product<Derived, OtherDerived>
|
||||
MatrixBase<Scalar, Derived>::lazyProduct(const MatrixBase<Scalar, OtherDerived> &other) const
|
||||
{
|
||||
return Product<Derived, OtherDerived>(ref(), other.ref());
|
||||
return Product<Derived, OtherDerived>(asArg(), other.asArg());
|
||||
}
|
||||
|
||||
/** \relates MatrixBase
|
||||
|
@ -49,7 +49,7 @@ template<typename MatrixType> class Random : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Random& _ref() const { return *this; }
|
||||
const Random& _asArg() const { return *this; }
|
||||
int _rows() const { return m_rows.value(); }
|
||||
int _cols() const { return m_cols.value(); }
|
||||
|
||||
|
@ -50,7 +50,7 @@ template<typename MatrixType> class Row
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Row>;
|
||||
friend class MatrixBase<Scalar, Row>::Traits;
|
||||
typedef MatrixBase<Scalar, Row> Base;
|
||||
@ -77,7 +77,7 @@ template<typename MatrixType> class Row
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Row& _ref() const { return *this; }
|
||||
const Row& _asArg() const { return *this; }
|
||||
|
||||
int _rows() const { return 1; }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
@ -107,7 +107,7 @@ template<typename Scalar, typename Derived>
|
||||
Row<Derived>
|
||||
MatrixBase<Scalar, Derived>::row(int i)
|
||||
{
|
||||
return Row<Derived>(ref(), i);
|
||||
return Row<Derived>(asArg(), i);
|
||||
}
|
||||
|
||||
/** This is the const version of row(). */
|
||||
@ -115,7 +115,7 @@ template<typename Scalar, typename Derived>
|
||||
const Row<Derived>
|
||||
MatrixBase<Scalar, Derived>::row(int i) const
|
||||
{
|
||||
return Row<Derived>(ref(), i);
|
||||
return Row<Derived>(asArg(), i);
|
||||
}
|
||||
|
||||
#endif // EIGEN_ROW_H
|
||||
|
@ -41,7 +41,7 @@ template<typename MatrixType> class ScalarMultiple : NoOperatorEquals,
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, ScalarMultiple>;
|
||||
friend class MatrixBase<Scalar, ScalarMultiple>::Traits;
|
||||
typedef MatrixBase<Scalar, ScalarMultiple> Base;
|
||||
@ -57,7 +57,7 @@ template<typename MatrixType> class ScalarMultiple : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const ScalarMultiple& _ref() const { return *this; }
|
||||
const ScalarMultiple& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.rows(); }
|
||||
int _cols() const { return m_matrix.cols(); }
|
||||
|
||||
@ -76,7 +76,7 @@ template<typename Scalar, typename Derived>
|
||||
const ScalarMultiple<Derived>
|
||||
MatrixBase<Scalar, Derived>::operator*(const Scalar& scalar) const
|
||||
{
|
||||
return ScalarMultiple<Derived>(ref(), scalar);
|
||||
return ScalarMultiple<Derived>(asArg(), scalar);
|
||||
}
|
||||
|
||||
/** \relates MatrixBase \sa class ScalarMultiple */
|
||||
@ -85,7 +85,7 @@ const ScalarMultiple<Derived>
|
||||
MatrixBase<Scalar, Derived>::operator/(const Scalar& scalar) const
|
||||
{
|
||||
assert(NumTraits<Scalar>::HasFloatingPoint);
|
||||
return ScalarMultiple<Derived>(ref(), static_cast<Scalar>(1) / scalar);
|
||||
return ScalarMultiple<Derived>(asArg(), static_cast<Scalar>(1) / scalar);
|
||||
}
|
||||
|
||||
/** \sa ScalarMultiple */
|
||||
|
@ -42,7 +42,7 @@ template<typename MatrixType> class Transpose
|
||||
{
|
||||
public:
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::Ref MatRef;
|
||||
typedef typename MatrixType::AsArg MatRef;
|
||||
friend class MatrixBase<Scalar, Transpose>;
|
||||
friend class MatrixBase<Scalar, Transpose>::Traits;
|
||||
typedef MatrixBase<Scalar, Transpose> Base;
|
||||
@ -59,7 +59,7 @@ template<typename MatrixType> class Transpose
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime
|
||||
};
|
||||
|
||||
const Transpose& _ref() const { return *this; }
|
||||
const Transpose& _asArg() const { return *this; }
|
||||
int _rows() const { return m_matrix.cols(); }
|
||||
int _cols() const { return m_matrix.rows(); }
|
||||
|
||||
@ -87,7 +87,7 @@ template<typename Scalar, typename Derived>
|
||||
Transpose<Derived>
|
||||
MatrixBase<Scalar, Derived>::transpose()
|
||||
{
|
||||
return Transpose<Derived>(ref());
|
||||
return Transpose<Derived>(asArg());
|
||||
}
|
||||
|
||||
/** This is the const version of transpose(). \sa adjoint() */
|
||||
@ -95,7 +95,7 @@ template<typename Scalar, typename Derived>
|
||||
const Transpose<Derived>
|
||||
MatrixBase<Scalar, Derived>::transpose() const
|
||||
{
|
||||
return Transpose<Derived>(ref());
|
||||
return Transpose<Derived>(asArg());
|
||||
}
|
||||
|
||||
/** \returns an expression of the adjoint (i.e. conjugate transpose) of *this.
|
||||
|
@ -49,7 +49,7 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
|
||||
MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
|
||||
};
|
||||
|
||||
const Zero& _ref() const { return *this; }
|
||||
const Zero& _asArg() const { return *this; }
|
||||
int _rows() const { return m_rows.value(); }
|
||||
int _cols() const { return m_cols.value(); }
|
||||
|
||||
|
@ -6,14 +6,14 @@ template<typename Scalar, typename Derived>
|
||||
Eigen::Block<Derived>
|
||||
topLeftCorner(MatrixBase<Scalar, Derived>& m, int rows, int cols)
|
||||
{
|
||||
return Eigen::Block<Derived>(m.ref(), 0, 0, rows, cols);
|
||||
return Eigen::Block<Derived>(m.asArg(), 0, 0, rows, cols);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
const Eigen::Block<Derived>
|
||||
topLeftCorner(const MatrixBase<Scalar, Derived>& m, int rows, int cols)
|
||||
{
|
||||
return Eigen::Block<Derived>(m.ref(), 0, 0, rows, cols);
|
||||
return Eigen::Block<Derived>(m.asArg(), 0, 0, rows, cols);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
@ -12,7 +12,7 @@ castToFloatingPoint(const MatrixBase<Scalar, Derived>& m)
|
||||
return Eigen::Cast<
|
||||
typename Eigen::NumTraits<Scalar>::FloatingPoint,
|
||||
Derived
|
||||
>(m.ref());
|
||||
>(m.asArg());
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
@ -6,14 +6,14 @@ template<typename Scalar, typename Derived>
|
||||
Eigen::Column<Derived>
|
||||
firstColumn(MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Column<Derived>(m.ref(), 0);
|
||||
return Eigen::Column<Derived>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
const Eigen::Column<Derived>
|
||||
firstColumn(const MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Column<Derived>(m.ref(), 0);
|
||||
return Eigen::Column<Derived>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
@ -13,7 +13,7 @@ template<typename Scalar, typename Derived1, typename Derived2>
|
||||
const Eigen::CwiseBinaryOp<CwiseMinOp, Derived1, Derived2>
|
||||
cwiseMin(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<CwiseMinOp, Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
return Eigen::CwiseBinaryOp<CwiseMinOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
|
||||
// Note that the above is equivalent to:
|
||||
// return mat1.template cwise<CwiseMinOp>(mat2);
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ template<typename Scalar, typename Derived>
|
||||
Eigen::Block<Derived, 2, 2>
|
||||
topLeft2x2Corner(MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Block<Derived, 2, 2>(m.ref(), 0, 0);
|
||||
return Eigen::Block<Derived, 2, 2>(m.asArg(), 0, 0);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
const Eigen::Block<Derived, 2, 2>
|
||||
topLeft2x2Corner(const MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Block<Derived, 2, 2>(m.ref(), 0, 0);
|
||||
return Eigen::Block<Derived, 2, 2>(m.asArg(), 0, 0);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
@ -6,14 +6,14 @@ template<typename Scalar, typename Derived>
|
||||
Eigen::Row<Derived>
|
||||
firstRow(MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Row<Derived>(m.ref(), 0);
|
||||
return Eigen::Row<Derived>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
const Eigen::Row<Derived>
|
||||
firstRow(const MatrixBase<Scalar, Derived>& m)
|
||||
{
|
||||
return Eigen::Row<Derived>(m.ref(), 0);
|
||||
return Eigen::Row<Derived>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
Loading…
x
Reference in New Issue
Block a user