mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-24 02:29:33 +08:00
switch to enums everywhere
This commit is contained in:
parent
209cf7c91f
commit
45a4b61b5f
@ -67,8 +67,10 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = BlockRows,
|
enum{
|
||||||
ColsAtCompileTime = BlockCols;
|
RowsAtCompileTime = BlockRows,
|
||||||
|
ColsAtCompileTime = BlockCols
|
||||||
|
};
|
||||||
|
|
||||||
const Block& _ref() const { return *this; }
|
const Block& _ref() const { return *this; }
|
||||||
int _rows() const { return BlockRows; }
|
int _rows() const { return BlockRows; }
|
||||||
|
@ -57,8 +57,10 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
|
|||||||
Cast(const MatRef& matrix) : m_matrix(matrix) {}
|
Cast(const MatRef& matrix) : m_matrix(matrix) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
const Cast& _ref() const { return *this; }
|
const Cast& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
int _cols() const { return m_matrix.cols(); }
|
int _cols() const { return m_matrix.cols(); }
|
||||||
|
@ -63,8 +63,11 @@ template<typename MatrixType> class Column
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Column)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Column)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = 1;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = 1
|
||||||
|
};
|
||||||
|
|
||||||
const Column& _ref() const { return *this; }
|
const Column& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
int _cols() const { return 1; }
|
int _cols() const { return 1; }
|
||||||
|
@ -49,8 +49,10 @@ template<typename MatrixType> class Conjugate : NoOperatorEquals,
|
|||||||
Conjugate(const MatRef& matrix) : m_matrix(matrix) {}
|
Conjugate(const MatRef& matrix) : m_matrix(matrix) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Conjugate& _ref() const { return *this; }
|
const Conjugate& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
|
@ -51,8 +51,10 @@ template<typename MatrixType> class DiagonalCoeffs
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = 1;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = 1
|
||||||
|
};
|
||||||
|
|
||||||
const DiagonalCoeffs& _ref() const { return *this; }
|
const DiagonalCoeffs& _ref() const { return *this; }
|
||||||
int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); }
|
int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); }
|
||||||
|
@ -52,16 +52,18 @@ class DiagonalMatrix : NoOperatorEquals,
|
|||||||
DiagonalMatrix(const CoeffsVecRef& coeffs) : m_coeffs(coeffs)
|
DiagonalMatrix(const CoeffsVecRef& coeffs) : m_coeffs(coeffs)
|
||||||
{
|
{
|
||||||
assert(CoeffsVectorType::Traits::IsVectorAtCompileTime
|
assert(CoeffsVectorType::Traits::IsVectorAtCompileTime
|
||||||
&& coeffs.size() > 0);
|
&& coeffs.coeffs() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime;
|
RowsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime,
|
||||||
|
ColsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const DiagonalMatrix& _ref() const { return *this; }
|
const DiagonalMatrix& _ref() const { return *this; }
|
||||||
int _rows() const { return m_coeffs.size(); }
|
int _rows() const { return m_coeffs.coeffs(); }
|
||||||
int _cols() const { return m_coeffs.size(); }
|
int _cols() const { return m_coeffs.coeffs(); }
|
||||||
|
|
||||||
Scalar _coeff(int row, int col) const
|
Scalar _coeff(int row, int col) const
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,10 @@ template<typename Lhs, typename Rhs> class Difference : NoOperatorEquals,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Difference& _ref() const { return *this; }
|
const Difference& _ref() const { return *this; }
|
||||||
int _rows() const { return m_lhs.rows(); }
|
int _rows() const { return m_lhs.rows(); }
|
||||||
|
@ -74,7 +74,7 @@ Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
|
|||||||
{
|
{
|
||||||
assert(Traits::IsVectorAtCompileTime
|
assert(Traits::IsVectorAtCompileTime
|
||||||
&& OtherDerived::Traits::IsVectorAtCompileTime
|
&& OtherDerived::Traits::IsVectorAtCompileTime
|
||||||
&& size() == other.size());
|
&& coeffs() == other.coeffs());
|
||||||
Scalar res;
|
Scalar res;
|
||||||
if(EIGEN_UNROLLED_LOOPS
|
if(EIGEN_UNROLLED_LOOPS
|
||||||
&& Traits::SizeAtCompileTime != Dynamic
|
&& Traits::SizeAtCompileTime != Dynamic
|
||||||
@ -85,7 +85,7 @@ Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = (*this).coeff(0) * conj(other.coeff(0));
|
res = (*this).coeff(0) * conj(other.coeff(0));
|
||||||
for(int i = 1; i < size(); i++)
|
for(int i = 1; i < coeffs(); i++)
|
||||||
res += (*this).coeff(i)* conj(other.coeff(i));
|
res += (*this).coeff(i)* conj(other.coeff(i));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -67,9 +67,10 @@ template<typename MatrixType> class DynBlock
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DynBlock)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DynBlock)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int
|
enum {
|
||||||
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime == 1 ? 1 : Dynamic,
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime == 1 ? 1 : Dynamic,
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime == 1 ? 1 : Dynamic;
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime == 1 ? 1 : Dynamic
|
||||||
|
};
|
||||||
|
|
||||||
const DynBlock& _ref() const { return *this; }
|
const DynBlock& _ref() const { return *this; }
|
||||||
int _rows() const { return m_blockRows; }
|
int _rows() const { return m_blockRows; }
|
||||||
|
@ -45,8 +45,10 @@ template<typename MatrixType> class Identity : NoOperatorEquals,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Identity& _ref() const { return *this; }
|
const Identity& _ref() const { return *this; }
|
||||||
int _rows() const { return m_rows; }
|
int _rows() const { return m_rows; }
|
||||||
|
@ -47,9 +47,11 @@ template<typename MatrixType> class Map
|
|||||||
friend class MatrixBase<Scalar, Map<MatrixType> >;
|
friend class MatrixBase<Scalar, Map<MatrixType> >;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
static const MatrixStorageOrder _Order = MatrixType::StorageOrder;
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
|
||||||
|
Order = MatrixType::StorageOrder
|
||||||
|
};
|
||||||
|
|
||||||
const Map& _ref() const { return *this; }
|
const Map& _ref() const { return *this; }
|
||||||
int _rows() const { return m_rows; }
|
int _rows() const { return m_rows; }
|
||||||
@ -57,7 +59,7 @@ template<typename MatrixType> class Map
|
|||||||
|
|
||||||
const Scalar& _coeff(int row, int col) const
|
const Scalar& _coeff(int row, int col) const
|
||||||
{
|
{
|
||||||
if(_Order == ColumnMajor)
|
if(Order == ColumnMajor)
|
||||||
return m_data[row + col * m_rows];
|
return m_data[row + col * m_rows];
|
||||||
else // RowMajor
|
else // RowMajor
|
||||||
return m_data[col + row * m_cols];
|
return m_data[col + row * m_cols];
|
||||||
@ -65,7 +67,7 @@ template<typename MatrixType> class Map
|
|||||||
|
|
||||||
Scalar& _coeffRef(int row, int col)
|
Scalar& _coeffRef(int row, int col)
|
||||||
{
|
{
|
||||||
if(_Order == ColumnMajor)
|
if(Order == ColumnMajor)
|
||||||
return const_cast<Scalar*>(m_data)[row + col * m_rows];
|
return const_cast<Scalar*>(m_data)[row + col * m_rows];
|
||||||
else // RowMajor
|
else // RowMajor
|
||||||
return const_cast<Scalar*>(m_data)[col + row * m_cols];
|
return const_cast<Scalar*>(m_data)[col + row * m_cols];
|
||||||
@ -88,7 +90,7 @@ template<typename MatrixType> class Map
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** This is the const version of map(Scalar*,int,int). */
|
/** This is the const version of map(Scalar*,int,int). */
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int rows, int cols)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int rows, int cols)
|
||||||
{
|
{
|
||||||
@ -96,7 +98,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int rows,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** This is the const version of map(Scalar*,int). */
|
/** This is the const version of map(Scalar*,int). */
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int size)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int size)
|
||||||
{
|
{
|
||||||
@ -108,7 +110,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** This is the const version of map(Scalar*). */
|
/** This is the const version of map(Scalar*). */
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
const Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data)
|
||||||
{
|
{
|
||||||
@ -126,7 +128,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(const Scalar* data)
|
|||||||
*
|
*
|
||||||
* \sa map(const Scalar*, int, int), map(Scalar*, int), map(Scalar*), class Map
|
* \sa map(const Scalar*, int, int), map(Scalar*, int), map(Scalar*), class Map
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int rows, int cols)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int rows, int cols)
|
||||||
{
|
{
|
||||||
@ -145,7 +147,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int rows, int co
|
|||||||
*
|
*
|
||||||
* \sa map(const Scalar*, int), map(Scalar*, int, int), map(Scalar*), class Map
|
* \sa map(const Scalar*, int), map(Scalar*, int, int), map(Scalar*), class Map
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int size)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int size)
|
||||||
{
|
{
|
||||||
@ -165,7 +167,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data, int size)
|
|||||||
*
|
*
|
||||||
* \sa map(const Scalar*), map(Scalar*, int), map(Scalar*, int, int), class Map
|
* \sa map(const Scalar*), map(Scalar*, int), map(Scalar*, int, int), class Map
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data)
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data)
|
||||||
{
|
{
|
||||||
@ -180,7 +182,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>::map(Scalar* data)
|
|||||||
*
|
*
|
||||||
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int, int)
|
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int, int)
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
||||||
::Matrix(const Scalar *data, int rows, int cols)
|
::Matrix(const Scalar *data, int rows, int cols)
|
||||||
: Storage(rows, cols)
|
: Storage(rows, cols)
|
||||||
@ -198,7 +200,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
|||||||
*
|
*
|
||||||
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int)
|
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int)
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
||||||
::Matrix(const Scalar *data, int size)
|
::Matrix(const Scalar *data, int size)
|
||||||
: Storage(size)
|
: Storage(size)
|
||||||
@ -216,7 +218,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
|||||||
* \sa Matrix(const Scalar *, int), Matrix(const Scalar *, int, int),
|
* \sa Matrix(const Scalar *, int), Matrix(const Scalar *, int, int),
|
||||||
* Matrix::map(const Scalar *)
|
* Matrix::map(const Scalar *)
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
|
||||||
::Matrix(const Scalar *data)
|
::Matrix(const Scalar *data)
|
||||||
: Storage()
|
: Storage()
|
||||||
|
@ -70,10 +70,10 @@
|
|||||||
* \c Matrix<double,3,5>.
|
* \c Matrix<double,3,5>.
|
||||||
*
|
*
|
||||||
* Note that most of the API is in the base class MatrixBase, and that the base class
|
* Note that most of the API is in the base class MatrixBase, and that the base class
|
||||||
* MatrixStorage also provides the MatrixStorage::resize() public method.
|
* MatrixStorage also provides the MatrixStorage::recoeffs() public method.
|
||||||
*/
|
*/
|
||||||
template<typename _Scalar, int _Rows, int _Cols,
|
template<typename _Scalar, int _Rows, int _Cols,
|
||||||
MatrixStorageOrder _StorageOrder = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER>
|
int _StorageOrder = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER>
|
||||||
class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >,
|
class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >,
|
||||||
public MatrixStorage<_Scalar, _Rows, _Cols>
|
public MatrixStorage<_Scalar, _Rows, _Cols>
|
||||||
{
|
{
|
||||||
@ -96,8 +96,11 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage
|
|||||||
{ return Storage::m_data; }
|
{ return Storage::m_data; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols;
|
enum {
|
||||||
static const MatrixStorageOrder StorageOrder = _StorageOrder;
|
RowsAtCompileTime = _Rows,
|
||||||
|
ColsAtCompileTime = _Cols,
|
||||||
|
StorageOrder = _StorageOrder
|
||||||
|
};
|
||||||
|
|
||||||
Ref _ref() const { return Ref(*this); }
|
Ref _ref() const { return Ref(*this); }
|
||||||
|
|
||||||
@ -132,12 +135,12 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage
|
|||||||
if(RowsAtCompileTime == 1)
|
if(RowsAtCompileTime == 1)
|
||||||
{
|
{
|
||||||
assert(other.isVector());
|
assert(other.isVector());
|
||||||
resize(1, other.size());
|
resize(1, other.coeffs());
|
||||||
}
|
}
|
||||||
else if(ColsAtCompileTime == 1)
|
else if(ColsAtCompileTime == 1)
|
||||||
{
|
{
|
||||||
assert(other.isVector());
|
assert(other.isVector());
|
||||||
resize(other.size(), 1);
|
resize(other.coeffs(), 1);
|
||||||
}
|
}
|
||||||
else resize(other.rows(), other.cols());
|
else resize(other.rows(), other.cols());
|
||||||
return Base::operator=(other);
|
return Base::operator=(other);
|
||||||
|
@ -64,27 +64,29 @@ template<typename Scalar, typename Derived> class MatrixBase
|
|||||||
* by the \a Derived type. If a value is not known at compile-time,
|
* by the \a Derived type. If a value is not known at compile-time,
|
||||||
* it is set to the \a Dynamic constant.
|
* it is set to the \a Dynamic constant.
|
||||||
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
|
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
|
||||||
static const int RowsAtCompileTime = Derived::RowsAtCompileTime;
|
enum { RowsAtCompileTime = Derived::RowsAtCompileTime };
|
||||||
|
|
||||||
/** The number of columns at compile-time. This is just a copy of the value provided
|
/** The number of columns at compile-time. This is just a copy of the value provided
|
||||||
* by the \a Derived type. If a value is not known at compile-time,
|
* by the \a Derived type. If a value is not known at compile-time,
|
||||||
* it is set to the \a Dynamic constant.
|
* it is set to the \a Dynamic constant.
|
||||||
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
|
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
|
||||||
static const int ColsAtCompileTime = Derived::ColsAtCompileTime;
|
enum { ColsAtCompileTime = Derived::ColsAtCompileTime };
|
||||||
|
|
||||||
/** This is equal to the number of coefficients, i.e. the number of
|
/** This is equal to the number of coefficients, i.e. the number of
|
||||||
* rows times the number of columns, or to \a Dynamic if this is not
|
* rows times the number of columns, or to \a Dynamic if this is not
|
||||||
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
|
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
|
||||||
static const int SizeAtCompileTime
|
enum { SizeAtCompileTime
|
||||||
= Derived::RowsAtCompileTime == Dynamic || Derived::ColsAtCompileTime == Dynamic
|
= Derived::RowsAtCompileTime == Dynamic || Derived::ColsAtCompileTime == Dynamic
|
||||||
? Dynamic : Derived::RowsAtCompileTime * Derived::ColsAtCompileTime;
|
? Dynamic : Derived::RowsAtCompileTime * Derived::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
/** This is set to true if either the number of rows or the number of
|
/** This is set to true if either the number of rows or the number of
|
||||||
* columns is known at compile-time to be equal to 1. Indeed, in that case,
|
* columns is known at compile-time to be equal to 1. Indeed, in that case,
|
||||||
* we are dealing with a column-vector (if there is only one column) or with
|
* we are dealing with a column-vector (if there is only one column) or with
|
||||||
* a row-vector (if there is only one row). */
|
* a row-vector (if there is only one row). */
|
||||||
static const bool IsVectorAtCompileTime
|
enum { IsVectorAtCompileTime
|
||||||
= Derived::RowsAtCompileTime == 1 || Derived::ColsAtCompileTime == 1;
|
= Derived::RowsAtCompileTime == 1 || Derived::ColsAtCompileTime == 1
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This is the "reference type" used to pass objects of type MatrixBase as arguments
|
/** This is the "reference type" used to pass objects of type MatrixBase as arguments
|
||||||
@ -113,7 +115,7 @@ template<typename Scalar, typename Derived> class MatrixBase
|
|||||||
int cols() const { return static_cast<const Derived *>(this)->_cols(); }
|
int cols() const { return static_cast<const Derived *>(this)->_cols(); }
|
||||||
/** \returns the number of coefficients, which is \a rows()*cols().
|
/** \returns the number of coefficients, which is \a rows()*cols().
|
||||||
* \sa rows(), cols(), Traits::SizeAtCompileTime. */
|
* \sa rows(), cols(), Traits::SizeAtCompileTime. */
|
||||||
int size() const { return rows() * cols(); }
|
int coeffs() const { return rows() * cols(); }
|
||||||
/** \returns true if either the number of rows or the number of columns is equal to 1.
|
/** \returns true if either the number of rows or the number of columns is equal to 1.
|
||||||
* In other words, this function returns
|
* In other words, this function returns
|
||||||
* \code rows()==1 || cols()==1 \endcode
|
* \code rows()==1 || cols()==1 \endcode
|
||||||
|
@ -39,8 +39,10 @@ template<typename MatrixType> class MatrixRef
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
int _cols() const { return m_matrix.cols(); }
|
int _cols() const { return m_matrix.cols(); }
|
||||||
|
@ -57,11 +57,12 @@ template<typename MatrixType> class Minor
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int
|
enum {
|
||||||
RowsAtCompileTime = (MatrixType::Traits::RowsAtCompileTime != Dynamic) ?
|
RowsAtCompileTime = (MatrixType::Traits::RowsAtCompileTime != Dynamic) ?
|
||||||
MatrixType::Traits::RowsAtCompileTime - 1 : Dynamic,
|
MatrixType::Traits::RowsAtCompileTime - 1 : Dynamic,
|
||||||
ColsAtCompileTime = (MatrixType::Traits::ColsAtCompileTime != Dynamic) ?
|
ColsAtCompileTime = (MatrixType::Traits::ColsAtCompileTime != Dynamic) ?
|
||||||
MatrixType::Traits::ColsAtCompileTime - 1 : Dynamic;
|
MatrixType::Traits::ColsAtCompileTime - 1 : Dynamic
|
||||||
|
};
|
||||||
|
|
||||||
const Minor& _ref() const { return *this; }
|
const Minor& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows() - 1; }
|
int _rows() const { return m_matrix.rows() - 1; }
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
* \li A typedef \a FloatingPoint, giving the "floating-point type" of \a T. If \a T is
|
* \li A typedef \a FloatingPoint, giving the "floating-point type" of \a T. If \a T is
|
||||||
* \c int, then \a FloatingPoint is a typedef to \c double. Otherwise, \a FloatingPoint
|
* \c int, then \a FloatingPoint is a typedef to \c double. Otherwise, \a FloatingPoint
|
||||||
* is a typedef to \a T.
|
* is a typedef to \a T.
|
||||||
* \li A static const bool \a IsComplex. It is equal to \c true if \a T is a \c std::complex
|
* \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex
|
||||||
* type, and to false otherwise.
|
* type, and to 0 otherwise.
|
||||||
* \li A static const bool \a HasFloatingPoint. It is equal to \c false if \a T is \c int,
|
* \li An enum \a HasFloatingPoint. It is equal to \c 0 if \a T is \c int,
|
||||||
* and to \c true otherwise.
|
* and to \c 1 otherwise.
|
||||||
*/
|
*/
|
||||||
template<typename T> struct NumTraits;
|
template<typename T> struct NumTraits;
|
||||||
|
|
||||||
@ -52,32 +52,40 @@ template<> struct NumTraits<int>
|
|||||||
{
|
{
|
||||||
typedef int Real;
|
typedef int Real;
|
||||||
typedef double FloatingPoint;
|
typedef double FloatingPoint;
|
||||||
static const bool IsComplex = false;
|
enum {
|
||||||
static const bool HasFloatingPoint = false;
|
IsComplex = 0,
|
||||||
|
HasFloatingPoint = 0
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct NumTraits<float>
|
template<> struct NumTraits<float>
|
||||||
{
|
{
|
||||||
typedef float Real;
|
typedef float Real;
|
||||||
typedef float FloatingPoint;
|
typedef float FloatingPoint;
|
||||||
static const bool IsComplex = false;
|
enum {
|
||||||
static const bool HasFloatingPoint = true;
|
IsComplex = 0,
|
||||||
|
HasFloatingPoint = 1
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct NumTraits<double>
|
template<> struct NumTraits<double>
|
||||||
{
|
{
|
||||||
typedef double Real;
|
typedef double Real;
|
||||||
typedef double FloatingPoint;
|
typedef double FloatingPoint;
|
||||||
static const bool IsComplex = false;
|
enum {
|
||||||
static const bool HasFloatingPoint = true;
|
IsComplex = 0,
|
||||||
|
HasFloatingPoint = 1
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Real> struct NumTraits<std::complex<_Real> >
|
template<typename _Real> struct NumTraits<std::complex<_Real> >
|
||||||
{
|
{
|
||||||
typedef _Real Real;
|
typedef _Real Real;
|
||||||
typedef std::complex<_Real> FloatingPoint;
|
typedef std::complex<_Real> FloatingPoint;
|
||||||
static const bool IsComplex = true;
|
enum {
|
||||||
static const bool HasFloatingPoint = NumTraits<Real>::HasFloatingPoint;
|
IsComplex = 1,
|
||||||
|
HasFloatingPoint = 1 // anyway we don't allow std::complex<int>
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EIGEN_NUMTRAITS_H
|
#endif // EIGEN_NUMTRAITS_H
|
||||||
|
@ -40,8 +40,10 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
|
|||||||
friend class MatrixBase<Scalar, Ones<MatrixType> >;
|
friend class MatrixBase<Scalar, Ones<MatrixType> >;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Ones& _ref() const { return *this; }
|
const Ones& _ref() const { return *this; }
|
||||||
int _rows() const { return m_rows; }
|
int _rows() const { return m_rows; }
|
||||||
|
@ -30,8 +30,10 @@
|
|||||||
template<typename Derived1, typename Derived2, int UnrollCount>
|
template<typename Derived1, typename Derived2, int UnrollCount>
|
||||||
struct MatrixOperatorEqualsUnroller
|
struct MatrixOperatorEqualsUnroller
|
||||||
{
|
{
|
||||||
static const int col = (UnrollCount-1) / Derived1::Traits::RowsAtCompileTime;
|
enum {
|
||||||
static const int row = (UnrollCount-1) % Derived1::Traits::RowsAtCompileTime;
|
col = (UnrollCount-1) / Derived1::Traits::RowsAtCompileTime,
|
||||||
|
row = (UnrollCount-1) % Derived1::Traits::RowsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
static void run(Derived1 &dst, const Derived2 &src)
|
static void run(Derived1 &dst, const Derived2 &src)
|
||||||
{
|
{
|
||||||
@ -65,7 +67,7 @@ struct MatrixOperatorEqualsUnroller<Derived1, Derived2, Dynamic>
|
|||||||
template<typename Derived1, typename Derived2, int UnrollCount>
|
template<typename Derived1, typename Derived2, int UnrollCount>
|
||||||
struct VectorOperatorEqualsUnroller
|
struct VectorOperatorEqualsUnroller
|
||||||
{
|
{
|
||||||
static const int index = UnrollCount - 1;
|
enum { index = UnrollCount - 1 };
|
||||||
|
|
||||||
static void run(Derived1 &dst, const Derived2 &src)
|
static void run(Derived1 &dst, const Derived2 &src)
|
||||||
{
|
{
|
||||||
@ -104,13 +106,13 @@ Derived& MatrixBase<Scalar, Derived>
|
|||||||
if(Traits::IsVectorAtCompileTime && OtherDerived::Traits::IsVectorAtCompileTime)
|
if(Traits::IsVectorAtCompileTime && OtherDerived::Traits::IsVectorAtCompileTime)
|
||||||
// copying a vector expression into a vector
|
// copying a vector expression into a vector
|
||||||
{
|
{
|
||||||
assert(size() == other.size());
|
assert(coeffs() == other.coeffs());
|
||||||
if(EIGEN_UNROLLED_LOOPS && Traits::SizeAtCompileTime != Dynamic && Traits::SizeAtCompileTime <= 25)
|
if(EIGEN_UNROLLED_LOOPS && Traits::SizeAtCompileTime != Dynamic && Traits::SizeAtCompileTime <= 25)
|
||||||
VectorOperatorEqualsUnroller
|
VectorOperatorEqualsUnroller
|
||||||
<Derived, OtherDerived, Traits::SizeAtCompileTime>::run
|
<Derived, OtherDerived, Traits::SizeAtCompileTime>::run
|
||||||
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
|
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
|
||||||
else
|
else
|
||||||
for(int i = 0; i < size(); i++)
|
for(int i = 0; i < coeffs(); i++)
|
||||||
coeffRef(i) = other.coeff(i);
|
coeffRef(i) = other.coeff(i);
|
||||||
return *static_cast<Derived*>(this);
|
return *static_cast<Derived*>(this);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,10 @@ template<typename MatrixType> class Opposite : NoOperatorEquals,
|
|||||||
Opposite(const MatRef& matrix) : m_matrix(matrix) {}
|
Opposite(const MatRef& matrix) : m_matrix(matrix) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Opposite& _ref() const { return *this; }
|
const Opposite& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
|
@ -89,8 +89,10 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Product& _ref() const { return *this; }
|
const Product& _ref() const { return *this; }
|
||||||
int _rows() const { return m_lhs.rows(); }
|
int _rows() const { return m_lhs.rows(); }
|
||||||
|
@ -40,8 +40,10 @@ template<typename MatrixType> class Random : NoOperatorEquals,
|
|||||||
friend class MatrixBase<Scalar, Random<MatrixType> >;
|
friend class MatrixBase<Scalar, Random<MatrixType> >;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Random& _ref() const { return *this; }
|
const Random& _ref() const { return *this; }
|
||||||
int _rows() const { return m_rows; }
|
int _rows() const { return m_rows; }
|
||||||
|
@ -69,8 +69,10 @@ template<typename MatrixType> class Row
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = 1,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = 1,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Row& _ref() const { return *this; }
|
const Row& _ref() const { return *this; }
|
||||||
|
|
||||||
|
@ -49,8 +49,10 @@ template<typename FactorType, typename MatrixType> class ScalarMultiple : NoOper
|
|||||||
: m_matrix(matrix), m_factor(factor) {}
|
: m_matrix(matrix), m_factor(factor) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const ScalarMultiple& _ref() const { return *this; }
|
const ScalarMultiple& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
|
@ -55,8 +55,10 @@ template<typename Lhs, typename Rhs> class Sum : NoOperatorEquals,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Sum& _ref() const { return *this; }
|
const Sum& _ref() const { return *this; }
|
||||||
int _rows() const { return m_lhs.rows(); }
|
int _rows() const { return m_lhs.rows(); }
|
||||||
|
@ -51,8 +51,10 @@ template<typename MatrixType> class Transpose
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::RowsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::RowsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Transpose& _ref() const { return *this; }
|
const Transpose& _ref() const { return *this; }
|
||||||
int _rows() const { return m_matrix.cols(); }
|
int _rows() const { return m_matrix.cols(); }
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
#define EIGEN_UNROLLED_LOOPS (true)
|
#define EIGEN_UNROLLED_LOOPS (true)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EIGEN_DEFAULT_MATRIX_STORAGE_ORDER
|
#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
|
||||||
|
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER RowMajor
|
||||||
|
#else
|
||||||
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER ColumnMajor
|
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER ColumnMajor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,15 +89,12 @@ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
|
|||||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
|
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
|
||||||
|
|
||||||
const int Dynamic = -1;
|
const int Dynamic = -1;
|
||||||
|
const int Generic = -2;
|
||||||
enum MatrixStorageOrder
|
const int ColumnMajor = 0;
|
||||||
{
|
const int RowMajor = 1;
|
||||||
ColumnMajor,
|
|
||||||
RowMajor
|
|
||||||
};
|
|
||||||
|
|
||||||
//forward declarations
|
//forward declarations
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
class Matrix;
|
class Matrix;
|
||||||
template<typename MatrixType> class MatrixRef;
|
template<typename MatrixType> class MatrixRef;
|
||||||
template<typename NewScalar, typename MatrixType> class Cast;
|
template<typename NewScalar, typename MatrixType> class Cast;
|
||||||
@ -125,7 +124,7 @@ template<typename T> struct ForwardDecl
|
|||||||
typedef T Ref;
|
typedef T Ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
|
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
|
||||||
struct ForwardDecl<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
struct ForwardDecl<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
|
||||||
{
|
{
|
||||||
typedef MatrixRef<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> > Ref;
|
typedef MatrixRef<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> > Ref;
|
||||||
|
@ -40,8 +40,10 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
|
|||||||
friend class MatrixBase<Scalar, Zero<MatrixType> >;
|
friend class MatrixBase<Scalar, Zero<MatrixType> >;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
enum {
|
||||||
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
|
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
|
||||||
|
ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
|
||||||
|
};
|
||||||
|
|
||||||
const Zero& _ref() const { return *this; }
|
const Zero& _ref() const { return *this; }
|
||||||
int _rows() const { return m_rows; }
|
int _rows() const { return m_rows; }
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
echo "Fixed size 3x3, ColumnMajor, -DNDEBUG"
|
echo "Fixed size 3x3, ColumnMajor, -DNDEBUG"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=ColumnMajor -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
g++ -O3 -I .. -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
||||||
echo "Fixed size 3x3, ColumnMajor, with asserts"
|
echo "Fixed size 3x3, ColumnMajor, with asserts"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=ColumnMajor benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
g++ -O3 -I .. benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
||||||
echo "Fixed size 3x3, RowMajor, -DNDEBUG"
|
echo "Fixed size 3x3, RowMajor, -DNDEBUG"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=RowMajor -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
g++ -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
||||||
echo "Fixed size 3x3, RowMajor, with asserts"
|
echo "Fixed size 3x3, RowMajor, with asserts"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=RowMajor benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
g++ -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmark.cpp -o benchmark && time ./benchmark >/dev/null
|
||||||
echo "Dynamic size 20x20, ColumnMajor, -DNDEBUG"
|
echo "Dynamic size 20x20, ColumnMajor, -DNDEBUG"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=ColumnMajor -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
g++ -O3 -I .. -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
||||||
echo "Dynamic size 20x20, ColumnMajor, with asserts"
|
echo "Dynamic size 20x20, ColumnMajor, with asserts"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=ColumnMajor benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
g++ -O3 -I .. benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
||||||
echo "Dynamic size 20x20, RowMajor, -DNDEBUG"
|
echo "Dynamic size 20x20, RowMajor, -DNDEBUG"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=RowMajor -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
g++ -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
||||||
echo "Dynamic size 20x20, RowMajor, with asserts"
|
echo "Dynamic size 20x20, RowMajor, with asserts"
|
||||||
g++ -O3 -I .. -DEIGEN_DEFAULT_MATRIX_STORAGE_ORDER=RowMajor benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
g++ -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null
|
||||||
|
@ -31,7 +31,7 @@ template<typename VectorType> void tmap(const VectorType& m)
|
|||||||
{
|
{
|
||||||
typedef typename VectorType::Scalar Scalar;
|
typedef typename VectorType::Scalar Scalar;
|
||||||
|
|
||||||
int size = m.size();
|
int size = m.coeffs();
|
||||||
|
|
||||||
// test Map.h
|
// test Map.h
|
||||||
Scalar* array1 = new Scalar[size];
|
Scalar* array1 = new Scalar[size];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user