mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 12:19:12 +08:00
Merge.
This commit is contained in:
commit
e6f0cd7121
@ -178,9 +178,9 @@ class MatrixFunction<MatrixType, 1>
|
|||||||
*
|
*
|
||||||
* This is morally a \c static \c const \c Scalar, but only
|
* This is morally a \c static \c const \c Scalar, but only
|
||||||
* integers can be static constant class members in C++. The
|
* integers can be static constant class members in C++. The
|
||||||
* separation constant is set to 0.01, a value taken from the
|
* separation constant is set to 0.1, a value taken from the
|
||||||
* paper by Davies and Higham. */
|
* paper by Davies and Higham. */
|
||||||
static const RealScalar separation() { return static_cast<RealScalar>(0.01); }
|
static const RealScalar separation() { return static_cast<RealScalar>(0.1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Constructor.
|
/** \brief Constructor.
|
||||||
@ -492,13 +492,11 @@ typename MatrixFunction<MatrixType,1>::DynMatrixType MatrixFunction<MatrixType,1
|
|||||||
template<typename Derived> class MatrixFunctionReturnValue
|
template<typename Derived> class MatrixFunctionReturnValue
|
||||||
: public ReturnByValue<MatrixFunctionReturnValue<Derived> >
|
: public ReturnByValue<MatrixFunctionReturnValue<Derived> >
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
|
||||||
typedef typename ei_traits<Derived>::Scalar Scalar;
|
typedef typename ei_traits<Derived>::Scalar Scalar;
|
||||||
typedef typename ei_stem_function<Scalar>::type StemFunction;
|
typedef typename ei_stem_function<Scalar>::type StemFunction;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/** \brief Constructor.
|
/** \brief Constructor.
|
||||||
*
|
*
|
||||||
* \param[in] A %Matrix (expression) forming the argument of the
|
* \param[in] A %Matrix (expression) forming the argument of the
|
||||||
|
@ -109,11 +109,10 @@ template<typename MatrixType>
|
|||||||
void testHyperbolicFunctions(const MatrixType& A)
|
void testHyperbolicFunctions(const MatrixType& A)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < g_repeat; i++) {
|
for (int i = 0; i < g_repeat; i++) {
|
||||||
MatrixType sinhA = ei_matrix_sinh(A);
|
|
||||||
MatrixType coshA = ei_matrix_cosh(A);
|
|
||||||
MatrixType expA = ei_matrix_exponential(A);
|
MatrixType expA = ei_matrix_exponential(A);
|
||||||
VERIFY_IS_APPROX(sinhA, (expA - expA.inverse())/2);
|
MatrixType expmA = ei_matrix_exponential(-A);
|
||||||
VERIFY_IS_APPROX(coshA, (expA + expA.inverse())/2);
|
VERIFY_IS_APPROX(ei_matrix_sinh(A), (expA - expmA) / 2);
|
||||||
|
VERIFY_IS_APPROX(ei_matrix_cosh(A), (expA + expmA) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,14 +133,15 @@ void testGonioFunctions(const MatrixType& A)
|
|||||||
ComplexMatrix Ac = A.template cast<ComplexScalar>();
|
ComplexMatrix Ac = A.template cast<ComplexScalar>();
|
||||||
|
|
||||||
ComplexMatrix exp_iA = ei_matrix_exponential(imagUnit * Ac);
|
ComplexMatrix exp_iA = ei_matrix_exponential(imagUnit * Ac);
|
||||||
|
ComplexMatrix exp_miA = ei_matrix_exponential(-imagUnit * Ac);
|
||||||
|
|
||||||
MatrixType sinA = ei_matrix_sin(A);
|
MatrixType sinA = ei_matrix_sin(A);
|
||||||
ComplexMatrix sinAc = sinA.template cast<ComplexScalar>();
|
ComplexMatrix sinAc = sinA.template cast<ComplexScalar>();
|
||||||
VERIFY_IS_APPROX(sinAc, (exp_iA - exp_iA.inverse()) / (two*imagUnit));
|
VERIFY_IS_APPROX(sinAc, (exp_iA - exp_miA) / (two*imagUnit));
|
||||||
|
|
||||||
MatrixType cosA = ei_matrix_cos(A);
|
MatrixType cosA = ei_matrix_cos(A);
|
||||||
ComplexMatrix cosAc = cosA.template cast<ComplexScalar>();
|
ComplexMatrix cosAc = cosA.template cast<ComplexScalar>();
|
||||||
VERIFY_IS_APPROX(cosAc, (exp_iA + exp_iA.inverse()) / 2);
|
VERIFY_IS_APPROX(cosAc, (exp_iA + exp_miA) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user