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));
void testMatrix(const MatrixType &A)
void testMatrixLogarithm(const MatrixType &A)
HouseholderSequenceType householderQ() const
void testMatrixExponential(const MatrixType &A)
bool test_isApprox_abs(const Type1 &a, const Type2 &b)
Matrix diag(const std::vector< Matrix > &Hs)
EIGEN_DEVICE_FUNC const ExpReturnType exp() const
void testMatrixType(const MatrixType &m)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
static MatrixType run(const typename MatrixType::Index size)
void testHyperbolicFunctions(const MatrixType &A)
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
NumTraits< Scalar >::Real RealScalar
void test_matrix_function()
ConjugateReturnType inverse() const
Inverse of the Householder sequence (equals the adjoint).
#define VERIFY_IS_APPROX_ABS(a, b)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
MatrixType randomMatrixWithRealEivals(const typename MatrixType::Index size)
static MatrixType run(const typename MatrixType::Index size)
void testGonioFunctions(const MatrixType &A)
static MatrixType run(const typename MatrixType::Index size)