Optimist
0.0.0
A C++ library for optimization
Toggle main menu visibility
Loading...
Searching...
No Matches
Sinh.hh
Go to the documentation of this file.
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Copyright (c) 2025, Davide Stocco and Enrico Bertolazzi. *
3
* *
4
* The Optimist project is distributed under the BSD 2-Clause License. *
5
* *
6
* Davide Stocco Enrico Bertolazzi *
7
* University of Trento University of Trento *
8
* davide.stocco@unitn.it enrico.bertolazzi@unitn.it *
9
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11
#pragma once
12
13
#ifndef OPTIMIST_TESTSET_SINH_HH
14
#define OPTIMIST_TESTSET_SINH_HH
15
16
#include "
Optimist/Function.hh
"
17
18
namespace
Optimist
{
19
20
namespace
TestSet {
21
33
template
<
typename
Scalar>
34
requires
TypeTrait<Scalar>::IsScalar
35
class
Sinh
:
public
Function
<Scalar, Scalar, Sinh<Scalar>> {
36
public
:
37
OPTIMIST_BASIC_CONSTANTS
(
Scalar
)
38
39
42
Sinh
() {
43
this->
m_solutions
.emplace_back(0.0);
// Zero
44
this->
m_guesses
.emplace_back(-10.0);
45
this->
m_guesses
.emplace_back(10.0);
46
}
47
52
constexpr
std::string
name_impl
()
const
{
53
return
"Sinh"
;
54
}
55
62
bool
evaluate_impl
(
const
Scalar
x,
Scalar
&out)
const
{
63
out = std::sinh(x);
64
return
std::isfinite(out);
65
}
66
73
bool
first_derivative_impl
(
const
Scalar
x,
Scalar
&out)
const
{
74
out = std::cosh(x);
75
return
std::isfinite(out);
76
}
77
84
bool
second_derivative_impl
(
const
Scalar
x,
Scalar
&out)
const
{
85
out = std::sinh(x);
86
return
std::isfinite(out);
87
}
88
89
};
// class Sinh
90
91
}
// namespace TestSet
92
93
}
// namespace Optimist
94
95
#endif
// OPTIMIST_TESTSET_SINH_HH
Function.hh
OPTIMIST_BASIC_CONSTANTS
#define OPTIMIST_BASIC_CONSTANTS(Scalar)
Definition
Optimist.hh:70
Optimist::FunctionBase< Scalar, Scalar, Sinh< Scalar > >::Scalar
typename InputTrait::Scalar Scalar
Definition
Function.hh:44
Optimist::FunctionBase< Scalar, Scalar, Sinh< Scalar > >::m_guesses
std::vector< Scalar > m_guesses
Definition
Function.hh:85
Optimist::FunctionBase< Scalar, Scalar, Sinh< Scalar > >::m_solutions
std::vector< Scalar > m_solutions
Definition
Function.hh:83
Optimist::Function< Scalar, Scalar, Sinh< Scalar > >::Function
Function()
Definition
Function.hh:236
Optimist::TestSet::Sinh::name_impl
constexpr std::string name_impl() const
Definition
Sinh.hh:52
Optimist::TestSet::Sinh::first_derivative_impl
bool first_derivative_impl(const Scalar x, Scalar &out) const
Definition
Sinh.hh:73
Optimist::TestSet::Sinh::evaluate_impl
bool evaluate_impl(const Scalar x, Scalar &out) const
Definition
Sinh.hh:62
Optimist::TestSet::Sinh::Sinh
Sinh()
Definition
Sinh.hh:42
Optimist::TestSet::Sinh::second_derivative_impl
bool second_derivative_impl(const Scalar x, Scalar &out) const
Definition
Sinh.hh:84
Optimist
Namespace for the Optimist library.
Definition
Optimist.hh:90
core
include
Optimist
TestSet
Sinh.hh
Generated by
1.18.0