diff options
author | 2008-04-10 10:33:50 +0000 | |
---|---|---|
committer | 2008-04-10 10:33:50 +0000 | |
commit | 613c49b475795f89caca3b3f204b5ef8287c4956 (patch) | |
tree | f4e113cae73743cfbd24e5c2229527883f26dd6e /Eigen/src/Core | |
parent | ca448d2537cac67d77aac6db62de846bfcbc3022 (diff) |
* add typedefs for matrices/vectors with LargeBit
* add -pedantic to CXXFLAGS
* cleanup intricated expressions with && and ||
which gave warnings because of "missing" parentheses
* fix compile error in NumTraits, apparently discovered
by -pedantic
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/Matrix.h | 29 | ||||
-rw-r--r-- | Eigen/src/Core/NumTraits.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 20 | ||||
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 2 |
4 files changed, 50 insertions, 15 deletions
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index da898f031..7c2c5afba 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -80,15 +80,23 @@ struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > MaxRowsAtCompileTime = _MaxRows, MaxColsAtCompileTime = _MaxCols, Flags = (_Flags & ~VectorizableBit) - | (( (ei_packet_traits<Scalar>::size>1) && (_Rows!=Dynamic) && (_Cols!=Dynamic) - && ((_Flags&RowMajorBit) && ((_Cols%ei_packet_traits<Scalar>::size)==0) - || ((_Rows%ei_packet_traits<Scalar>::size)==0) ) ) ? VectorizableBit : 0), + | ( + ( + ei_packet_traits<Scalar>::size>1 + && _Rows!=Dynamic + && _Cols!=Dynamic + && ( + (_Flags&RowMajorBit && _Cols%ei_packet_traits<Scalar>::size==0) + || (_Rows%ei_packet_traits<Scalar>::size==0) + ) + ) ? VectorizableBit : 0 + ), CoeffReadCost = NumTraits<Scalar>::ReadCost }; }; template<typename _Scalar, int _Rows, int _Cols, - unsigned int _Flags = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER, + unsigned int _Flags = EIGEN_DEFAULT_MATRIX_FLAGS, int _MaxRows = _Rows, int _MaxCols = _Cols> class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > @@ -328,6 +336,19 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_TYPEDEFS +#define EIGEN_MAKE_TYPEDEFS_LARGE(Type, TypeSuffix) \ +typedef Matrix<Type, Dynamic, Dynamic, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> MatrixXL##TypeSuffix; \ +typedef Matrix<Type, Dynamic, 1, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> VectorXL##TypeSuffix; \ +typedef Matrix<Type, 1, Dynamic, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> RowVectorXL##TypeSuffix; + +EIGEN_MAKE_TYPEDEFS_LARGE(int, i) +EIGEN_MAKE_TYPEDEFS_LARGE(float, f) +EIGEN_MAKE_TYPEDEFS_LARGE(double, d) +EIGEN_MAKE_TYPEDEFS_LARGE(std::complex<float>, cf) +EIGEN_MAKE_TYPEDEFS_LARGE(std::complex<double>, cd) + +#undef EIGEN_MAKE_TYPEDEFS_LARGE + #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ using Eigen::Matrix##SizeSuffix##TypeSuffix; \ using Eigen::Vector##SizeSuffix##TypeSuffix; \ diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h index 137f38ee2..b1ac341db 100644 --- a/Eigen/src/Core/NumTraits.h +++ b/Eigen/src/Core/NumTraits.h @@ -56,7 +56,7 @@ template<> struct NumTraits<int> HasFloatingPoint = 0, ReadCost = 1, AddCost = 1, - MulCost = 1, + MulCost = 1 }; }; @@ -69,7 +69,7 @@ template<> struct NumTraits<float> HasFloatingPoint = 1, ReadCost = 1, AddCost = 1, - MulCost = 1, + MulCost = 1 }; }; @@ -82,7 +82,7 @@ template<> struct NumTraits<double> HasFloatingPoint = 1, ReadCost = 1, AddCost = 1, - MulCost = 1, + MulCost = 1 }; }; @@ -95,7 +95,7 @@ template<typename _Real> struct NumTraits<std::complex<_Real> > HasFloatingPoint = NumTraits<Real>::HasFloatingPoint, ReadCost = 2, AddCost = 2 * NumTraits<Real>::AddCost, - MulCost = 4 * NumTraits<Real>::MulCost + 2 * NumTraits<Real>::AddCost, + MulCost = 4 * NumTraits<Real>::MulCost + 2 * NumTraits<Real>::AddCost }; }; @@ -108,7 +108,7 @@ template<> struct NumTraits<long long int> HasFloatingPoint = 0, ReadCost = 1, AddCost = 1, - MulCost = 1, + MulCost = 1 }; }; @@ -121,7 +121,7 @@ template<> struct NumTraits<long double> HasFloatingPoint = 1, ReadCost = 1, AddCost = 2, - MulCost = 2, + MulCost = 2 }; }; @@ -134,7 +134,7 @@ template<> struct NumTraits<bool> HasFloatingPoint = 0, ReadCost = 1, AddCost = 1, - MulCost = 1, + MulCost = 1 }; }; diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 5d39f0c2b..4dacb9269 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -134,10 +134,22 @@ struct ei_traits<Product<Lhs, Rhs, EvalMode> > : (unsigned int)(LhsFlags | RhsFlags) & ~LargeBit ) | EvalBeforeAssigningBit | (ei_product_eval_mode<Lhs, Rhs>::value == (int)CacheOptimalProduct ? EvalBeforeNestingBit : 0)) - & (~(RowMajorBit | VectorizableBit)) - | (((!(Lhs::Flags & RowMajorBit)) && (Lhs::Flags & VectorizableBit)) ? VectorizableBit - : ((Rhs::Flags & RowMajorBit && (Rhs::Flags & VectorizableBit)) ? (RowMajorBit | VectorizableBit) - : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER)), + & ( + ~(RowMajorBit | VectorizableBit) + | ( + ( + !(Lhs::Flags & RowMajorBit) && (Lhs::Flags & VectorizableBit) + ) + ? VectorizableBit + : ( + ( + (Rhs::Flags & RowMajorBit) && (Rhs::Flags & VectorizableBit) + ) + ? RowMajorBit | VectorizableBit + : 0 + ) + ) + ), CoeffReadCost = Lhs::ColsAtCompileTime == Dynamic ? Dynamic diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 84a2a0eef..e7d7d3968 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -43,6 +43,8 @@ #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER 0 #endif +#define EIGEN_DEFAULT_MATRIX_FLAGS EIGEN_DEFAULT_MATRIX_STORAGE_ORDER + #define USING_PART_OF_NAMESPACE_EIGEN \ EIGEN_USING_MATRIX_TYPEDEFS \ using Eigen::Matrix; \ |