Doc: difference between array and matrix cosine etc (bug #830)

This commit is contained in:
Jitse Niesen 2014-09-06 14:59:44 +01:00
parent 25bceefb4e
commit abb33258ce
2 changed files with 35 additions and 4 deletions

View File

@ -29,6 +29,9 @@ abs2() const
} }
/** \returns an expression of the coefficient-wise exponential of *this. /** \returns an expression of the coefficient-wise exponential of *this.
*
* This function computes the coefficient-wise exponential. The function MatrixBase::exp() in the
* unsupported module MatrixFunctions computes the matrix exponential.
* *
* Example: \include Cwise_exp.cpp * Example: \include Cwise_exp.cpp
* Output: \verbinclude Cwise_exp.out * Output: \verbinclude Cwise_exp.out
@ -43,6 +46,9 @@ exp() const
} }
/** \returns an expression of the coefficient-wise logarithm of *this. /** \returns an expression of the coefficient-wise logarithm of *this.
*
* This function computes the coefficient-wise logarithm. The function MatrixBase::log() in the
* unsupported module MatrixFunctions computes the matrix logarithm.
* *
* Example: \include Cwise_log.cpp * Example: \include Cwise_log.cpp
* Output: \verbinclude Cwise_log.out * Output: \verbinclude Cwise_log.out
@ -57,6 +63,9 @@ log() const
} }
/** \returns an expression of the coefficient-wise square root of *this. /** \returns an expression of the coefficient-wise square root of *this.
*
* This function computes the coefficient-wise square root. The function MatrixBase::sqrt() in the
* unsupported module MatrixFunctions computes the matrix square root.
* *
* Example: \include Cwise_sqrt.cpp * Example: \include Cwise_sqrt.cpp
* Output: \verbinclude Cwise_sqrt.out * Output: \verbinclude Cwise_sqrt.out
@ -71,6 +80,9 @@ sqrt() const
} }
/** \returns an expression of the coefficient-wise cosine of *this. /** \returns an expression of the coefficient-wise cosine of *this.
*
* This function computes the coefficient-wise cosine. The function MatrixBase::cos() in the
* unsupported module MatrixFunctions computes the matrix cosine.
* *
* Example: \include Cwise_cos.cpp * Example: \include Cwise_cos.cpp
* Output: \verbinclude Cwise_cos.out * Output: \verbinclude Cwise_cos.out
@ -86,6 +98,9 @@ cos() const
/** \returns an expression of the coefficient-wise sine of *this. /** \returns an expression of the coefficient-wise sine of *this.
*
* This function computes the coefficient-wise sine. The function MatrixBase::sin() in the
* unsupported module MatrixFunctions computes the matrix sine.
* *
* Example: \include Cwise_sin.cpp * Example: \include Cwise_sin.cpp
* Output: \verbinclude Cwise_sin.out * Output: \verbinclude Cwise_sin.out
@ -155,6 +170,9 @@ atan() const
} }
/** \returns an expression of the coefficient-wise power of *this to the given exponent. /** \returns an expression of the coefficient-wise power of *this to the given exponent.
*
* This function computes the coefficient-wise power. The function MatrixBase::pow() in the
* unsupported module MatrixFunctions computes the matrix power.
* *
* Example: \include Cwise_pow.cpp * Example: \include Cwise_pow.cpp
* Output: \verbinclude Cwise_pow.out * Output: \verbinclude Cwise_pow.out

View File

@ -82,7 +82,9 @@ const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cos() const
\param[in] M a square matrix. \param[in] M a square matrix.
\returns expression representing \f$ \cos(M) \f$. \returns expression representing \f$ \cos(M) \f$.
This function calls \ref matrixbase_matrixfunction "matrixFunction()" with StdStemFunctions::cos(). This function computes the matrix cosine. Use ArrayBase::cos() for computing the entry-wise cosine.
The implementation calls \ref matrixbase_matrixfunction "matrixFunction()" with StdStemFunctions::cos().
\sa \ref matrixbase_sin "sin()" for an example. \sa \ref matrixbase_sin "sin()" for an example.
@ -123,6 +125,9 @@ differential equations: the solution of \f$ y' = My \f$ with the
initial condition \f$ y(0) = y_0 \f$ is given by initial condition \f$ y(0) = y_0 \f$ is given by
\f$ y(t) = \exp(M) y_0 \f$. \f$ y(t) = \exp(M) y_0 \f$.
The matrix exponential is different from applying the exp function to all the entries in the matrix.
Use ArrayBase::exp() if you want to do the latter.
The cost of the computation is approximately \f$ 20 n^3 \f$ for The cost of the computation is approximately \f$ 20 n^3 \f$ for
matrices of size \f$ n \f$. The number 20 depends weakly on the matrices of size \f$ n \f$. The number 20 depends weakly on the
norm of the matrix. norm of the matrix.
@ -177,6 +182,9 @@ the scalar logarithm, the equation \f$ \exp(X) = M \f$ may have
multiple solutions; this function returns a matrix whose eigenvalues multiple solutions; this function returns a matrix whose eigenvalues
have imaginary part in the interval \f$ (-\pi,\pi] \f$. have imaginary part in the interval \f$ (-\pi,\pi] \f$.
The matrix logarithm is different from applying the log function to all the entries in the matrix.
Use ArrayBase::log() if you want to do the latter.
In the real case, the matrix \f$ M \f$ should be invertible and In the real case, the matrix \f$ M \f$ should be invertible and
it should have no eigenvalues which are real and negative (pairs of it should have no eigenvalues which are real and negative (pairs of
complex conjugate eigenvalues are allowed). In the complex case, it complex conjugate eigenvalues are allowed). In the complex case, it
@ -232,7 +240,8 @@ const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(RealScalar p) con
The matrix power \f$ M^p \f$ is defined as \f$ \exp(p \log(M)) \f$, The matrix power \f$ M^p \f$ is defined as \f$ \exp(p \log(M)) \f$,
where exp denotes the matrix exponential, and log denotes the matrix where exp denotes the matrix exponential, and log denotes the matrix
logarithm. logarithm. This is different from raising all the entries in the matrix
to the p-th power. Use ArrayBase::pow() if you want to do the latter.
If \p p is complex, the scalar type of \p M should be the type of \p If \p p is complex, the scalar type of \p M should be the type of \p
p . \f$ M^p \f$ simply evaluates into \f$ \exp(p \log(M)) \f$. p . \f$ M^p \f$ simply evaluates into \f$ \exp(p \log(M)) \f$.
@ -391,7 +400,9 @@ const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sin() const
\param[in] M a square matrix. \param[in] M a square matrix.
\returns expression representing \f$ \sin(M) \f$. \returns expression representing \f$ \sin(M) \f$.
This function calls \ref matrixbase_matrixfunction "matrixFunction()" with StdStemFunctions::sin(). This function computes the matrix sine. Use ArrayBase::sin() for computing the entry-wise sine.
The implementation calls \ref matrixbase_matrixfunction "matrixFunction()" with StdStemFunctions::sin().
Example: \include MatrixSine.cpp Example: \include MatrixSine.cpp
Output: \verbinclude MatrixSine.out Output: \verbinclude MatrixSine.out
@ -428,7 +439,9 @@ const MatrixSquareRootReturnValue<Derived> MatrixBase<Derived>::sqrt() const
The matrix square root of \f$ M \f$ is the matrix \f$ M^{1/2} \f$ The matrix square root of \f$ M \f$ is the matrix \f$ M^{1/2} \f$
whose square is the original matrix; so if \f$ S = M^{1/2} \f$ then whose square is the original matrix; so if \f$ S = M^{1/2} \f$ then
\f$ S^2 = M \f$. \f$ S^2 = M \f$. This is different from taking the square root of all
the entries in the matrix; use ArrayBase::sqrt() if you want to do the
latter.
In the <b>real case</b>, the matrix \f$ M \f$ should be invertible and In the <b>real case</b>, the matrix \f$ M \f$ should be invertible and
it should have no eigenvalues which are real and negative (pairs of it should have no eigenvalues which are real and negative (pairs of