From 3d94ed9fa0bc06771c39970bcae6705ca2524cad Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Sun, 21 Jul 2013 00:18:19 +0800 Subject: [PATCH] Document on MatrixExponential::ScalingOp --- .../src/MatrixFunctions/MatrixExponential.h | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 810f426f9..30b36a179 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -126,6 +126,7 @@ class MatrixExponential : internal::noncopyable */ void computeUV(long double); + struct ScalingOp; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename std::complex ComplexScalar; @@ -153,22 +154,35 @@ class MatrixExponential : internal::noncopyable /** \brief L1 norm of m_M. */ RealScalar m_l1norm; - - /** \brief Scaling operator. */ - struct ScalingOp; }; +/** \brief Scaling operator. + * + * This struct is used by CwiseUnaryOp to scale a matrix by \f$ 2^{-s} \f$. + */ template struct MatrixExponential::ScalingOp { + /** \brief Constructor. + * + * \param[in] squarings The integer \f$ s \f$ in this document. + */ ScalingOp(int squarings) : m_squarings(squarings) { } + /** \brief Scale a matrix coefficient. + * + * \param[in,out] x The scalar to be scaled, becoming \f$ 2^{-s} x \f$. + */ inline const RealScalar operator() (const RealScalar& x) const { using std::ldexp; return ldexp(x, -m_squarings); } + /** \brief Scale a matrix coefficient. + * + * \param[in,out] x The scalar to be scaled, becoming \f$ 2^{-s} x \f$. + */ inline const ComplexScalar operator() (const ComplexScalar& x) const { using std::ldexp;