<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
mpreal.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
5//
6// This file is part of <T>LAPACK.
7// <T>LAPACK is free software: you can redistribute it and/or modify it under
8// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
9
10#ifndef TLAPACK_MPREAL_HH
11#define TLAPACK_MPREAL_HH
12
13#include <mpreal.h>
14
16
17namespace tlapack {
18
19using mpfr::abs;
20
21namespace traits {
22 // mpfr::mpreal is a real type that satisfies tlapack::concepts::Real
23 template <>
25 using type = mpfr::mpreal;
26 constexpr static bool is_real = true;
27 };
28 // The complex type of mpfr::mpreal is std::complex<mpfr::mpreal>
29 template <>
31 using type = std::complex<mpfr::mpreal>;
32 constexpr static bool is_complex = false;
33 };
34} // namespace traits
35
36// Argument-dependent lookup (ADL) will include the remaining functions,
37// e.g., mpfr::sin, mpfr::cos.
38// Including them here may cause ambiguous call of overloaded function.
39// See: https://en.cppreference.com/w/cpp/language/adl
40
41#ifdef MPREAL_HAVE_DYNAMIC_STD_NUMERIC_LIMITS
42
43// Forward declaration
44template <typename real_t>
45int digits() noexcept;
46
47// Specialization for the mpfr::mpreal datatype
48template <>
50{
51 return std::numeric_limits<mpfr::mpreal>::digits();
52}
53
54#endif
55
56} // namespace tlapack
57
58#endif // TLAPACK_MPREAL_HH
int digits() noexcept
Digits.
Definition constants.hpp:64
typename traits::real_type_traits< Types..., int >::type real_type
The common real type of the list of types.
Definition scalar_type_traits.hpp:113
constexpr bool is_complex
True if T is a complex scalar type.
Definition scalar_type_traits.hpp:192
constexpr bool is_real
True if T is a real scalar type.
Definition scalar_type_traits.hpp:117
Complex type traits for the list of types Types.
Definition scalar_type_traits.hpp:145
Real type traits for the list of types Types.
Definition scalar_type_traits.hpp:71