aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-10 20:45:35 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-10 20:45:35 +0000
commit45a4b61b5fd6dab699f75e62dcf891d3faaf8384 (patch)
tree2eb2a5343a2174283c3a1569a09cae2951c559ba /Eigen/src/Core
parent209cf7c91f4276ca666509d2613ae0e71d4e76a8 (diff)
switch to enums everywhere
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/Block.h6
-rw-r--r--Eigen/src/Core/Cast.h6
-rw-r--r--Eigen/src/Core/Column.h7
-rw-r--r--Eigen/src/Core/Conjugate.h6
-rw-r--r--Eigen/src/Core/DiagonalCoeffs.h6
-rw-r--r--Eigen/src/Core/DiagonalMatrix.h12
-rw-r--r--Eigen/src/Core/Difference.h6
-rw-r--r--Eigen/src/Core/Dot.h4
-rw-r--r--Eigen/src/Core/DynBlock.h5
-rw-r--r--Eigen/src/Core/Identity.h6
-rw-r--r--Eigen/src/Core/Map.h30
-rw-r--r--Eigen/src/Core/Matrix.h15
-rw-r--r--Eigen/src/Core/MatrixBase.h16
-rw-r--r--Eigen/src/Core/MatrixRef.h6
-rw-r--r--Eigen/src/Core/Minor.h5
-rw-r--r--Eigen/src/Core/NumTraits.h32
-rw-r--r--Eigen/src/Core/Ones.h6
-rw-r--r--Eigen/src/Core/OperatorEquals.h12
-rw-r--r--Eigen/src/Core/Opposite.h6
-rw-r--r--Eigen/src/Core/Product.h6
-rw-r--r--Eigen/src/Core/Random.h6
-rw-r--r--Eigen/src/Core/Row.h6
-rw-r--r--Eigen/src/Core/ScalarMultiple.h6
-rw-r--r--Eigen/src/Core/Sum.h6
-rw-r--r--Eigen/src/Core/Transpose.h6
-rw-r--r--Eigen/src/Core/Util.h17
-rw-r--r--Eigen/src/Core/Zero.h6
27 files changed, 153 insertions, 98 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index 92d8a1d8d..45a1eb707 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -67,8 +67,10 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
private:
- static const int RowsAtCompileTime = BlockRows,
- ColsAtCompileTime = BlockCols;
+ enum{
+ RowsAtCompileTime = BlockRows,
+ ColsAtCompileTime = BlockCols
+ };
const Block& _ref() const { return *this; }
int _rows() const { return BlockRows; }
diff --git a/Eigen/src/Core/Cast.h b/Eigen/src/Core/Cast.h
index 73fdbc25a..6963003cc 100644
--- a/Eigen/src/Core/Cast.h
+++ b/Eigen/src/Core/Cast.h
@@ -57,8 +57,10 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
Cast(const MatRef& matrix) : m_matrix(matrix) {}
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Cast& _ref() const { return *this; }
int _rows() const { return m_matrix.rows(); }
int _cols() const { return m_matrix.cols(); }
diff --git a/Eigen/src/Core/Column.h b/Eigen/src/Core/Column.h
index 53af21528..5265bcbb1 100644
--- a/Eigen/src/Core/Column.h
+++ b/Eigen/src/Core/Column.h
@@ -63,8 +63,11 @@ template<typename MatrixType> class Column
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Column)
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = 1;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = 1
+ };
+
const Column& _ref() const { return *this; }
int _rows() const { return m_matrix.rows(); }
int _cols() const { return 1; }
diff --git a/Eigen/src/Core/Conjugate.h b/Eigen/src/Core/Conjugate.h
index 48423e0b1..e99ca547c 100644
--- a/Eigen/src/Core/Conjugate.h
+++ b/Eigen/src/Core/Conjugate.h
@@ -49,8 +49,10 @@ template<typename MatrixType> class Conjugate : NoOperatorEquals,
Conjugate(const MatRef& matrix) : m_matrix(matrix) {}
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Conjugate& _ref() const { return *this; }
int _rows() const { return m_matrix.rows(); }
diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h
index b3bc8c7fe..bd8ac2c8b 100644
--- a/Eigen/src/Core/DiagonalCoeffs.h
+++ b/Eigen/src/Core/DiagonalCoeffs.h
@@ -51,8 +51,10 @@ template<typename MatrixType> class DiagonalCoeffs
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs)
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = 1;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = 1
+ };
const DiagonalCoeffs& _ref() const { return *this; }
int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); }
diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h
index 9ce9871eb..b36bce15a 100644
--- a/Eigen/src/Core/DiagonalMatrix.h
+++ b/Eigen/src/Core/DiagonalMatrix.h
@@ -52,16 +52,18 @@ class DiagonalMatrix : NoOperatorEquals,
DiagonalMatrix(const CoeffsVecRef& coeffs) : m_coeffs(coeffs)
{
assert(CoeffsVectorType::Traits::IsVectorAtCompileTime
- && coeffs.size() > 0);
+ && coeffs.coeffs() > 0);
}
private:
- static const int RowsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime,
- ColsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime;
+ enum {
+ RowsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime,
+ ColsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime
+ };
const DiagonalMatrix& _ref() const { return *this; }
- int _rows() const { return m_coeffs.size(); }
- int _cols() const { return m_coeffs.size(); }
+ int _rows() const { return m_coeffs.coeffs(); }
+ int _cols() const { return m_coeffs.coeffs(); }
Scalar _coeff(int row, int col) const
{
diff --git a/Eigen/src/Core/Difference.h b/Eigen/src/Core/Difference.h
index 814ab937e..ae4424a75 100644
--- a/Eigen/src/Core/Difference.h
+++ b/Eigen/src/Core/Difference.h
@@ -55,8 +55,10 @@ template<typename Lhs, typename Rhs> class Difference : NoOperatorEquals,
}
private:
- static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
- ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
+ };
const Difference& _ref() const { return *this; }
int _rows() const { return m_lhs.rows(); }
diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h
index 3ff416fba..4b84cfbab 100644
--- a/Eigen/src/Core/Dot.h
+++ b/Eigen/src/Core/Dot.h
@@ -74,7 +74,7 @@ Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
{
assert(Traits::IsVectorAtCompileTime
&& OtherDerived::Traits::IsVectorAtCompileTime
- && size() == other.size());
+ && coeffs() == other.coeffs());
Scalar res;
if(EIGEN_UNROLLED_LOOPS
&& Traits::SizeAtCompileTime != Dynamic
@@ -85,7 +85,7 @@ Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
else
{
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));
}
return res;
diff --git a/Eigen/src/Core/DynBlock.h b/Eigen/src/Core/DynBlock.h
index da32bcd28..7291314d9 100644
--- a/Eigen/src/Core/DynBlock.h
+++ b/Eigen/src/Core/DynBlock.h
@@ -67,9 +67,10 @@ template<typename MatrixType> class DynBlock
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DynBlock)
private:
- static const int
+ enum {
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; }
int _rows() const { return m_blockRows; }
diff --git a/Eigen/src/Core/Identity.h b/Eigen/src/Core/Identity.h
index bf40acda4..bf7b2de27 100644
--- a/Eigen/src/Core/Identity.h
+++ b/Eigen/src/Core/Identity.h
@@ -45,8 +45,10 @@ template<typename MatrixType> class Identity : NoOperatorEquals,
}
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Identity& _ref() const { return *this; }
int _rows() const { return m_rows; }
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index ca16d1a23..cf4a3c3fb 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -47,9 +47,11 @@ template<typename MatrixType> class Map
friend class MatrixBase<Scalar, Map<MatrixType> >;
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
- static const MatrixStorageOrder _Order = MatrixType::StorageOrder;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
+ Order = MatrixType::StorageOrder
+ };
const Map& _ref() const { return *this; }
int _rows() const { return m_rows; }
@@ -57,7 +59,7 @@ template<typename MatrixType> class Map
const Scalar& _coeff(int row, int col) const
{
- if(_Order == ColumnMajor)
+ if(Order == ColumnMajor)
return m_data[row + col * m_rows];
else // RowMajor
return m_data[col + row * m_cols];
@@ -65,7 +67,7 @@ template<typename MatrixType> class Map
Scalar& _coeffRef(int row, int col)
{
- if(_Order == ColumnMajor)
+ if(Order == ColumnMajor)
return const_cast<Scalar*>(m_data)[row + col * m_rows];
else // RowMajor
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). */
-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> >
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). */
-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> >
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*). */
-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> >
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
*/
-template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
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
*/
-template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
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
*/
-template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
Map<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >
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)
*/
-template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
::Matrix(const Scalar *data, int rows, int cols)
: Storage(rows, cols)
@@ -198,7 +200,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
*
* \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(const Scalar *data, int size)
: Storage(size)
@@ -216,7 +218,7 @@ Matrix<_Scalar, _Rows, _Cols, _StorageOrder>
* \sa Matrix(const Scalar *, int), Matrix(const Scalar *, int, int),
* 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(const Scalar *data)
: Storage()
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index 0165d5a7d..78eb64a9c 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -70,10 +70,10 @@
* \c Matrix<double,3,5>.
*
* 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,
- MatrixStorageOrder _StorageOrder = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER>
+ int _StorageOrder = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER>
class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _StorageOrder> >,
public MatrixStorage<_Scalar, _Rows, _Cols>
{
@@ -96,8 +96,11 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage
{ return Storage::m_data; }
private:
- static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols;
- static const MatrixStorageOrder StorageOrder = _StorageOrder;
+ enum {
+ RowsAtCompileTime = _Rows,
+ ColsAtCompileTime = _Cols,
+ StorageOrder = _StorageOrder
+ };
Ref _ref() const { return Ref(*this); }
@@ -132,12 +135,12 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage
if(RowsAtCompileTime == 1)
{
assert(other.isVector());
- resize(1, other.size());
+ resize(1, other.coeffs());
}
else if(ColsAtCompileTime == 1)
{
assert(other.isVector());
- resize(other.size(), 1);
+ resize(other.coeffs(), 1);
}
else resize(other.rows(), other.cols());
return Base::operator=(other);
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index a32568d29..c817cf4de 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -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,
* it is set to the \a Dynamic constant.
* \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
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \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
* rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
- static const int SizeAtCompileTime
+ enum { SizeAtCompileTime
= 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
* 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
* a row-vector (if there is only one row). */
- static const bool IsVectorAtCompileTime
- = Derived::RowsAtCompileTime == 1 || Derived::ColsAtCompileTime == 1;
+ enum { IsVectorAtCompileTime
+ = Derived::RowsAtCompileTime == 1 || Derived::ColsAtCompileTime == 1
+ };
};
/** 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(); }
/** \returns the number of coefficients, which is \a rows()*cols().
* \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.
* In other words, this function returns
* \code rows()==1 || cols()==1 \endcode
diff --git a/Eigen/src/Core/MatrixRef.h b/Eigen/src/Core/MatrixRef.h
index 0d97f9b4d..ce097fd3b 100644
--- a/Eigen/src/Core/MatrixRef.h
+++ b/Eigen/src/Core/MatrixRef.h
@@ -39,8 +39,10 @@ template<typename MatrixType> class MatrixRef
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
int _rows() const { return m_matrix.rows(); }
int _cols() const { return m_matrix.cols(); }
diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h
index c846e16f2..84419c8f6 100644
--- a/Eigen/src/Core/Minor.h
+++ b/Eigen/src/Core/Minor.h
@@ -57,11 +57,12 @@ template<typename MatrixType> class Minor
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor)
private:
- static const int
+ enum {
RowsAtCompileTime = (MatrixType::Traits::RowsAtCompileTime != Dynamic) ?
MatrixType::Traits::RowsAtCompileTime - 1 : Dynamic,
ColsAtCompileTime = (MatrixType::Traits::ColsAtCompileTime != Dynamic) ?
- MatrixType::Traits::ColsAtCompileTime - 1 : Dynamic;
+ MatrixType::Traits::ColsAtCompileTime - 1 : Dynamic
+ };
const Minor& _ref() const { return *this; }
int _rows() const { return m_matrix.rows() - 1; }
diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h
index bb6d5de7e..ae540dacb 100644
--- a/Eigen/src/Core/NumTraits.h
+++ b/Eigen/src/Core/NumTraits.h
@@ -41,10 +41,10 @@
* \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
* 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
- * type, and to false otherwise.
- * \li A static const bool \a HasFloatingPoint. It is equal to \c false if \a T is \c int,
- * and to \c true otherwise.
+ * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex
+ * type, and to 0 otherwise.
+ * \li An enum \a HasFloatingPoint. It is equal to \c 0 if \a T is \c int,
+ * and to \c 1 otherwise.
*/
template<typename T> struct NumTraits;
@@ -52,32 +52,40 @@ template<> struct NumTraits<int>
{
typedef int Real;
typedef double FloatingPoint;
- static const bool IsComplex = false;
- static const bool HasFloatingPoint = false;
+ enum {
+ IsComplex = 0,
+ HasFloatingPoint = 0
+ };
};
template<> struct NumTraits<float>
{
typedef float Real;
typedef float FloatingPoint;
- static const bool IsComplex = false;
- static const bool HasFloatingPoint = true;
+ enum {
+ IsComplex = 0,
+ HasFloatingPoint = 1
+ };
};
template<> struct NumTraits<double>
{
typedef double Real;
typedef double FloatingPoint;
- static const bool IsComplex = false;
- static const bool HasFloatingPoint = true;
+ enum {
+ IsComplex = 0,
+ HasFloatingPoint = 1
+ };
};
template<typename _Real> struct NumTraits<std::complex<_Real> >
{
typedef _Real Real;
typedef std::complex<_Real> FloatingPoint;
- static const bool IsComplex = true;
- static const bool HasFloatingPoint = NumTraits<Real>::HasFloatingPoint;
+ enum {
+ IsComplex = 1,
+ HasFloatingPoint = 1 // anyway we don't allow std::complex<int>
+ };
};
#endif // EIGEN_NUMTRAITS_H
diff --git a/Eigen/src/Core/Ones.h b/Eigen/src/Core/Ones.h
index 3bb11423e..1822d6090 100644
--- a/Eigen/src/Core/Ones.h
+++ b/Eigen/src/Core/Ones.h
@@ -40,8 +40,10 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
friend class MatrixBase<Scalar, Ones<MatrixType> >;
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Ones& _ref() const { return *this; }
int _rows() const { return m_rows; }
diff --git a/Eigen/src/Core/OperatorEquals.h b/Eigen/src/Core/OperatorEquals.h
index 4fe3dbe15..49da872c0 100644
--- a/Eigen/src/Core/OperatorEquals.h
+++ b/Eigen/src/Core/OperatorEquals.h
@@ -30,8 +30,10 @@
template<typename Derived1, typename Derived2, int UnrollCount>
struct MatrixOperatorEqualsUnroller
{
- static const int col = (UnrollCount-1) / Derived1::Traits::RowsAtCompileTime;
- static const int row = (UnrollCount-1) % Derived1::Traits::RowsAtCompileTime;
+ enum {
+ col = (UnrollCount-1) / Derived1::Traits::RowsAtCompileTime,
+ row = (UnrollCount-1) % Derived1::Traits::RowsAtCompileTime
+ };
static void run(Derived1 &dst, const Derived2 &src)
{
@@ -65,7 +67,7 @@ struct MatrixOperatorEqualsUnroller<Derived1, Derived2, Dynamic>
template<typename Derived1, typename Derived2, int UnrollCount>
struct VectorOperatorEqualsUnroller
{
- static const int index = UnrollCount - 1;
+ enum { index = UnrollCount - 1 };
static void run(Derived1 &dst, const Derived2 &src)
{
@@ -104,13 +106,13 @@ Derived& MatrixBase<Scalar, Derived>
if(Traits::IsVectorAtCompileTime && OtherDerived::Traits::IsVectorAtCompileTime)
// 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)
VectorOperatorEqualsUnroller
<Derived, OtherDerived, Traits::SizeAtCompileTime>::run
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
else
- for(int i = 0; i < size(); i++)
+ for(int i = 0; i < coeffs(); i++)
coeffRef(i) = other.coeff(i);
return *static_cast<Derived*>(this);
}
diff --git a/Eigen/src/Core/Opposite.h b/Eigen/src/Core/Opposite.h
index 7f7aabd23..93f0fe13f 100644
--- a/Eigen/src/Core/Opposite.h
+++ b/Eigen/src/Core/Opposite.h
@@ -49,8 +49,10 @@ template<typename MatrixType> class Opposite : NoOperatorEquals,
Opposite(const MatRef& matrix) : m_matrix(matrix) {}
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Opposite& _ref() const { return *this; }
int _rows() const { return m_matrix.rows(); }
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index 71e29a088..29685b344 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -89,8 +89,10 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
}
private:
- static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
- ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
+ };
const Product& _ref() const { return *this; }
int _rows() const { return m_lhs.rows(); }
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index bbc74ec1a..ad6142f4d 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -40,8 +40,10 @@ template<typename MatrixType> class Random : NoOperatorEquals,
friend class MatrixBase<Scalar, Random<MatrixType> >;
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Random& _ref() const { return *this; }
int _rows() const { return m_rows; }
diff --git a/Eigen/src/Core/Row.h b/Eigen/src/Core/Row.h
index 5fcab9e3a..f120f0c5c 100644
--- a/Eigen/src/Core/Row.h
+++ b/Eigen/src/Core/Row.h
@@ -69,8 +69,10 @@ template<typename MatrixType> class Row
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row)
private:
- static const int RowsAtCompileTime = 1,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = 1,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Row& _ref() const { return *this; }
diff --git a/Eigen/src/Core/ScalarMultiple.h b/Eigen/src/Core/ScalarMultiple.h
index e8261f539..c9f15bffb 100644
--- a/Eigen/src/Core/ScalarMultiple.h
+++ b/Eigen/src/Core/ScalarMultiple.h
@@ -49,8 +49,10 @@ template<typename FactorType, typename MatrixType> class ScalarMultiple : NoOper
: m_matrix(matrix), m_factor(factor) {}
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const ScalarMultiple& _ref() const { return *this; }
int _rows() const { return m_matrix.rows(); }
diff --git a/Eigen/src/Core/Sum.h b/Eigen/src/Core/Sum.h
index 93cfc4e4b..7cdedcfca 100644
--- a/Eigen/src/Core/Sum.h
+++ b/Eigen/src/Core/Sum.h
@@ -55,8 +55,10 @@ template<typename Lhs, typename Rhs> class Sum : NoOperatorEquals,
}
private:
- static const int RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
- ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = Rhs::Traits::ColsAtCompileTime
+ };
const Sum& _ref() const { return *this; }
int _rows() const { return m_lhs.rows(); }
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index fbb37bc60..21e6168f5 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -51,8 +51,10 @@ template<typename MatrixType> class Transpose
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
private:
- static const int RowsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::RowsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::RowsAtCompileTime
+ };
const Transpose& _ref() const { return *this; }
int _rows() const { return m_matrix.cols(); }
diff --git a/Eigen/src/Core/Util.h b/Eigen/src/Core/Util.h
index 288d9999d..72b355530 100644
--- a/Eigen/src/Core/Util.h
+++ b/Eigen/src/Core/Util.h
@@ -32,7 +32,9 @@
#define EIGEN_UNROLLED_LOOPS (true)
#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
#endif
@@ -87,15 +89,12 @@ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
const int Dynamic = -1;
-
-enum MatrixStorageOrder
-{
- ColumnMajor,
- RowMajor
-};
+const int Generic = -2;
+const int ColumnMajor = 0;
+const int RowMajor = 1;
//forward declarations
-template<typename _Scalar, int _Rows, int _Cols, MatrixStorageOrder _StorageOrder>
+template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder>
class Matrix;
template<typename MatrixType> class MatrixRef;
template<typename NewScalar, typename MatrixType> class Cast;
@@ -125,7 +124,7 @@ template<typename T> struct ForwardDecl
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> >
{
typedef MatrixRef<Matrix<_Scalar, _Rows, _Cols, _StorageOrder> > Ref;
diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h
index 76c13b4e4..a854acc1d 100644
--- a/Eigen/src/Core/Zero.h
+++ b/Eigen/src/Core/Zero.h
@@ -40,8 +40,10 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
friend class MatrixBase<Scalar, Zero<MatrixType> >;
private:
- static const int RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime;
+ enum {
+ RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ };
const Zero& _ref() const { return *this; }
int _rows() const { return m_rows; }