aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h16
-rw-r--r--Eigen/src/Core/DenseBase.h8
-rw-r--r--Eigen/src/Core/MatrixBase.h10
-rw-r--r--Eigen/src/Core/util/ForwardDeclarations.h26
4 files changed, 53 insertions, 7 deletions
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index 9ed005dce..df13d3aad 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -121,8 +121,20 @@ class CwiseBinaryOp : ei_no_assignment_operator,
ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
}
- EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
- EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
+ EIGEN_STRONG_INLINE int rows() const {
+ // return the fixed size type if available to enable compile time optimizations
+ if (ei_traits<typename ei_cleantype<LhsNested>::type>::RowsAtCompileTime==Dynamic)
+ return m_rhs.rows();
+ else
+ return m_lhs.rows();
+ }
+ EIGEN_STRONG_INLINE int cols() const {
+ // return the fixed size type if available to enable compile time optimizations
+ if (ei_traits<typename ei_cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic)
+ return m_rhs.cols();
+ else
+ return m_lhs.cols();
+ }
/** \returns the left hand side nested expression */
const _LhsNested& lhs() const { return m_lhs; }
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index ecce3ad05..74945fc79 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -491,8 +491,12 @@ template<typename Derived> class DenseBase
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy.
*/
- EIGEN_STRONG_INLINE const typename ei_eval<Derived>::type eval() const
- { return typename ei_eval<Derived>::type(derived()); }
+ inline const typename ei_eval<Derived>::type eval() const
+ {
+ // MSVC cannot honor strong inlining when the return type
+ // is a dynamic matrix
+ return typename ei_eval<Derived>::type(derived());
+ }
template<typename OtherDerived>
void swap(DenseBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other);
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index ac79de66d..fd9577ca4 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -372,6 +372,16 @@ template<typename Derived> class MatrixBase
template<typename OtherScalar>
void applyOnTheRight(int p, int q, const PlanarRotation<OtherScalar>& j);
+///////// MatrixFunctions module /////////
+
+ typedef typename ei_stem_function<Scalar>::type StemFunction;
+ const MatrixExponentialReturnValue<Derived> exp() const;
+ const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const;
+ const MatrixFunctionReturnValue<Derived> cosh() const;
+ const MatrixFunctionReturnValue<Derived> sinh() const;
+ const MatrixFunctionReturnValue<Derived> cos() const;
+ const MatrixFunctionReturnValue<Derived> sin() const;
+
#ifdef EIGEN2_SUPPORT
template<typename ProductDerived, typename Lhs, typename Rhs>
Derived& operator+=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h
index d0ba7328f..eb7e93b91 100644
--- a/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -46,10 +46,19 @@ template<typename ExpressionType> class NestByValue;
template<typename ExpressionType> class ForceAlignedAccess;
template<typename ExpressionType> class SwapWrapper;
template<typename MatrixType> class Minor;
-// MSVC will not compile when the expression ei_traits<MatrixType>::Flags&DirectAccessBit
-// is put into brackets like (ei_traits<MatrixType>::Flags&DirectAccessBit)!
+
+// MSVC has a big bug: when the expression ei_traits<MatrixType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess
+// is used as default template parameter value here, it gets mis-evaluated as just ei_traits<MatrixType>::Flags
+// Moreover, adding brackets tends to give compilation errors with MSVC.
+// Solution: defer that to a helper struct.
+template<typename MatrixType>
+struct ei_block_direct_access_status
+{
+ enum { ret = ei_traits<MatrixType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess };
+};
template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic,
- int _DirectAccessStatus = ei_traits<MatrixType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess> class Block;
+ int _DirectAccessStatus = ei_block_direct_access_status<MatrixType>::ret> class Block;
+
template<typename MatrixType, int Size=Dynamic> class VectorBlock;
template<typename MatrixType> class Transpose;
template<typename MatrixType> class Conjugate;
@@ -163,6 +172,17 @@ template<typename Scalar,int Dim> class Translation;
template<typename Scalar> class UniformScaling;
template<typename MatrixType,int Direction> class Homogeneous;
+// MatrixFunctions module
+template<typename Derived> struct MatrixExponentialReturnValue;
+template<typename Derived> struct MatrixFunctionReturnValue;
+template <typename Scalar>
+struct ei_stem_function
+{
+ typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
+ typedef ComplexScalar type(ComplexScalar, int);
+};
+
+
#ifdef EIGEN2_SUPPORT
template<typename ExpressionType> class Cwise;
#endif