2 #include <Eigen/MPRealSupport> 4 #include <Eigen/Eigenvalues> 23 for(
int i = 0; i < g_repeat; i++) {
24 int s = Eigen::internal::random<int>(1,100);
25 MatrixXmp
A = MatrixXmp::Random(s,s);
26 MatrixXmp B = MatrixXmp::Random(s,s);
27 MatrixXmp S = A.adjoint() * A;
29 MatrixXcmp Ac = MatrixXcmp::Random(s,s);
30 MatrixXcmp Bc = MatrixXcmp::Random(s,s);
31 MatrixXcmp Sc = Ac.adjoint() * Ac;
35 VERIFY_IS_APPROX(A.real(), A);
36 VERIFY(Eigen::internal::isApprox(A.array().abs2().sum(), A.squaredNorm()));
37 VERIFY_IS_APPROX(A.array().exp(),
exp(A.array()));
38 VERIFY_IS_APPROX(A.array().abs2().sqrt(), A.array().abs());
39 VERIFY_IS_APPROX(A.array().sin(),
sin(A.array()));
40 VERIFY_IS_APPROX(A.array().cos(),
cos(A.array()));
43 X = S.selfadjointView<
Lower>().llt().solve(B);
44 VERIFY_IS_APPROX((S.selfadjointView<
Lower>()*X).eval(),B);
46 Xc = Sc.selfadjointView<
Lower>().llt().solve(Bc);
47 VERIFY_IS_APPROX((Sc.selfadjointView<
Lower>()*Xc).eval(),Bc);
51 VERIFY_IS_APPROX((A*X).eval(),B);
60 MatrixXmp
A(8,3); A.setRandom();
62 std::stringstream stream;
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Computes eigenvalues and eigenvectors of selfadjoint matrices.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
const mpreal cos(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
EIGEN_DEVICE_FUNC ComputationInfo info() const
Reports whether previous computation was successful.
static void set_default_prec(mp_prec_t prec)
const mpreal sin(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
EIGEN_DEVICE_FUNC const RealVectorType & eigenvalues() const
Returns the eigenvalues of given matrix.
void test_mpreal_support()
EIGEN_DEVICE_FUNC const EigenvectorsType & eigenvectors() const
Returns the eigenvectors of given matrix.
The matrix class, also used for vectors and row-vectors.