11 #include <unsupported/Eigen/MatrixFunctions> 15 #define VERIFY_IS_APPROX_ABS(a, b) VERIFY(test_isApprox_abs(a, b)) 17 template<
typename Type1,
typename Type2>
20 return ((a-b).
array().
abs() < test_precision<typename Type1::RealScalar>()).all();
25 template<
typename MatrixType>
48 template<
typename MatrixType>
57 Index randomInt = internal::random<Index>(-1, 1);
58 if (randomInt == 0 || i == size-1) {
59 diag(i, i) = internal::random<Scalar>() *
Scalar(0.01);
75 template<
typename MatrixType>
82 const Scalar imagUnit(0, 1);
95 template<
typename MatrixType>
100 typedef std::complex<RealScalar> ComplexScalar;
102 VERIFY_IS_APPROX(A.exp(), A.matrixFunction(internal::stem_function_exp<ComplexScalar>));
105 template<
typename MatrixType>
112 RealScalar maxImagPartOfSpectrum = A.eigenvalues().imag().cwiseAbs().maxCoeff();
114 scaledA = A *
RealScalar(0.9
L * EIGEN_PI) / maxImagPartOfSpectrum;
124 template<
typename MatrixType>
133 template<
typename MatrixType>
138 typedef std::complex<RealScalar> ComplexScalar;
139 typedef Matrix<ComplexScalar, MatrixType::RowsAtCompileTime,
140 MatrixType::ColsAtCompileTime, MatrixType::Options> ComplexMatrix;
142 ComplexScalar imagUnit(0,1);
143 ComplexScalar two(2,0);
145 ComplexMatrix Ac = A.template cast<ComplexScalar>();
147 ComplexMatrix exp_iA = (imagUnit * Ac).
exp();
148 ComplexMatrix exp_miA = (-imagUnit * Ac).
exp();
150 ComplexMatrix sinAc = A.sin().template cast<ComplexScalar>();
153 ComplexMatrix cosAc = A.cos().template cast<ComplexScalar>();
157 template<
typename MatrixType>
166 template<
typename MatrixType>
175 testMatrix(randomMatrixWithRealEivals<MatrixType>(size));
180 template<
typename MatrixType>
205 Y = X.cos() + Rc.cos() + Mc.cos();
206 Y = X.sin() + Rc.sin() + Mc.sin();
208 Y = X.cosh() + Rc.cosh() + Mc.cosh();
209 Y = X.sinh() + Rc.sinh() + Mc.sinh();
void testMatrix(const MatrixType &A)
void testMatrixLogarithm(const MatrixType &A)
#define CALL_SUBTEST_6(FUNC)
#define CALL_SUBTEST_4(FUNC)
Matrix< RealScalar, Dynamic, Dynamic > M
void testMatrixExponential(const MatrixType &A)
bool test_isApprox_abs(const Type1 &a, const Type2 &b)
Matrix diag(const std::vector< Matrix > &Hs)
A matrix or vector expression mapping an existing array of data.
#define CALL_SUBTEST_3(FUNC)
#define CALL_SUBTEST_7(FUNC)
void testMapRef(const MatrixType &A)
Rot2 R(Rot2::fromAngle(0.1))
void testMatrixType(const MatrixType &m)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
MatrixType randomMatrixWithRealEivals(const Index size)
EIGEN_DECLARE_TEST(matrix_function)
void testHyperbolicFunctions(const MatrixType &A)
EIGEN_DEVICE_FUNC const ExpReturnType exp() const
AdjointReturnType inverse() const
Inverse of the Householder sequence (equals the adjoint).
#define VERIFY_IS_APPROX(a, b)
#define CALL_SUBTEST_1(FUNC)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
HouseholderSequenceType householderQ() const
NumTraits< Scalar >::Real RealScalar
static MatrixType run(const Index size)
A matrix or vector expression mapping an existing expression.
#define CALL_SUBTEST_5(FUNC)
static MatrixType run(const Index size)
static MatrixType run(const Index size)
#define VERIFY_IS_APPROX_ABS(a, b)
#define CALL_SUBTEST_2(FUNC)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
void testGonioFunctions(const MatrixType &A)