ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
zoo
ROL_ScalarTraits.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Rapid Optimization Library (ROL) Package
4
//
5
// Copyright 2014 NTESS and the ROL contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#pragma once
11
#ifndef ROL_SCALARTRAITS_HPP
12
#define ROL_SCALARTRAITS_HPP
13
14
#include <limits>
15
#include <complex>
16
17
18
namespace
ROL
{
19
20
template
<
typename
Real>
21
struct
ScalarTraits_Magnitude
{
22
using
type
= Real;
23
};
24
25
template
<
typename
Real>
26
struct
ScalarTraits_Magnitude
<std::complex<Real>> {
27
using
type
= Real;
28
};
29
30
31
template
<
typename
Real>
32
struct
ScalarTraits
{
33
34
using
magnitudeType
=
typename
ScalarTraits_Magnitude<Real>::type
;
35
36
static
constexpr
Real
zero
() noexcept {
return
static_cast<
Real
>
(0.0); }
37
static
constexpr
Real
half
() noexcept {
return
static_cast<
Real
>
(0.5); }
38
static
constexpr
Real
one
() noexcept {
return
static_cast<
Real
>
(1.0); }
39
static
constexpr
Real
two
() noexcept {
return
static_cast<
Real
>
(2.0); }
40
41
static
constexpr
Real
eps
() noexcept {
42
return
std::numeric_limits<Real>::epsilon();
43
}
44
45
static
constexpr
Real
rmin
() noexcept {
46
return
std::numeric_limits<Real>::min();
47
}
48
49
static
constexpr
Real
rmax
() noexcept {
50
return
std::numeric_limits<Real>::max();
51
}
52
53
static
constexpr
Real
two_pi
() noexcept {
54
return
static_cast<
Real
>
( 6.283185307179586476925286766559005768L );
55
}
56
57
static
constexpr
Real
pi
() noexcept {
58
return
static_cast<
Real
>
( 3.141592653589793238462643383279502884L );
59
}
60
61
static
constexpr
Real
half_pi
() noexcept {
62
return
static_cast<
Real
>
( 1.570796326794896619231321691639751442L );
63
}
64
65
static
constexpr
Real
quarter_pi
() noexcept {
66
return
static_cast<
Real
>
( 7.85398163397448309615660845819875721e-1L );
67
}
68
69
static
constexpr
Real
sqrt_two_pi
() noexcept {
70
return
static_cast<
Real
>
( 2.506628274631000502415765284811045252L );
71
}
72
73
static
constexpr
Real
sqrt_pi
() noexcept {
74
return
static_cast<
Real
>
( 1.772453850905516027298167483341145182L );
75
}
76
77
static
constexpr
Real
sqrt_half_pi
() noexcept {
78
return
static_cast<
Real
>
( 1.253314137315500251207882642405522626L );
79
}
80
81
static
constexpr
Real
sqrt_two
() noexcept {
82
return
static_cast<
Real
>
( 1.414213562373095048801688724209698078L );
83
}
84
85
};
86
87
88
}
// namespace ROL
89
90
#endif
// ROL_SCALARTRAITS_HPP
91
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::ScalarTraits_Magnitude< std::complex< Real > >::type
Real type
Definition
ROL_ScalarTraits.hpp:27
ROL::ScalarTraits_Magnitude
Definition
ROL_ScalarTraits.hpp:21
ROL::ScalarTraits_Magnitude::type
Real type
Definition
ROL_ScalarTraits.hpp:22
ROL::ScalarTraits
Definition
ROL_ScalarTraits.hpp:32
ROL::ScalarTraits::sqrt_pi
static constexpr Real sqrt_pi() noexcept
Definition
ROL_ScalarTraits.hpp:73
ROL::ScalarTraits::one
static constexpr Real one() noexcept
Definition
ROL_ScalarTraits.hpp:38
ROL::ScalarTraits::rmin
static constexpr Real rmin() noexcept
Definition
ROL_ScalarTraits.hpp:45
ROL::ScalarTraits::quarter_pi
static constexpr Real quarter_pi() noexcept
Definition
ROL_ScalarTraits.hpp:65
ROL::ScalarTraits::two
static constexpr Real two() noexcept
Definition
ROL_ScalarTraits.hpp:39
ROL::ScalarTraits::magnitudeType
typename ScalarTraits_Magnitude< Real >::type magnitudeType
Definition
ROL_ScalarTraits.hpp:34
ROL::ScalarTraits::half
static constexpr Real half() noexcept
Definition
ROL_ScalarTraits.hpp:37
ROL::ScalarTraits::half_pi
static constexpr Real half_pi() noexcept
Definition
ROL_ScalarTraits.hpp:61
ROL::ScalarTraits::pi
static constexpr Real pi() noexcept
Definition
ROL_ScalarTraits.hpp:57
ROL::ScalarTraits::sqrt_half_pi
static constexpr Real sqrt_half_pi() noexcept
Definition
ROL_ScalarTraits.hpp:77
ROL::ScalarTraits::rmax
static constexpr Real rmax() noexcept
Definition
ROL_ScalarTraits.hpp:49
ROL::ScalarTraits::sqrt_two
static constexpr Real sqrt_two() noexcept
Definition
ROL_ScalarTraits.hpp:81
ROL::ScalarTraits::sqrt_two_pi
static constexpr Real sqrt_two_pi() noexcept
Definition
ROL_ScalarTraits.hpp:69
ROL::ScalarTraits::zero
static constexpr Real zero() noexcept
Definition
ROL_ScalarTraits.hpp:36
ROL::ScalarTraits::eps
static constexpr Real eps() noexcept
Definition
ROL_ScalarTraits.hpp:41
ROL::ScalarTraits::two_pi
static constexpr Real two_pi() noexcept
Definition
ROL_ScalarTraits.hpp:53
Generated by
1.17.0