Optimist
0.0.0
A C++ library for optimization
Toggle main menu visibility
Loading...
Searching...
No Matches
Cosh.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_COSH_HH
14
#define OPTIMIST_TESTSET_COSH_HH
15
16
#include "
Optimist/Function.hh
"
17
18
namespace
Optimist
{
19
20
namespace
TestSet {
21
34
template
<
typename
Scalar>
35
requires
TypeTrait<Scalar>::IsScalar
36
class
Cosh
:
public
Function
<Scalar, Scalar, Cosh<Scalar>> {
37
public
:
38
OPTIMIST_BASIC_CONSTANTS
(
Scalar
)
39
40
43
Cosh
() {
44
this->
m_solutions
.emplace_back(0.0);
// Minimum
45
this->
m_guesses
.emplace_back(-1.0);
46
this->
m_guesses
.emplace_back(1.0);
47
}
48
53
constexpr
std::string
name_impl
()
const
{
54
return
"Cosh"
;
55
}
56
63
bool
evaluate_impl
(
const
Scalar
x,
Scalar
&out)
const
{
64
out = std::cosh(x);
65
return
std::isfinite(out);
66
}
67
74
bool
first_derivative_impl
(
const
Scalar
x,
Scalar
&out)
const
{
75
out = std::sinh(x);
76
return
std::isfinite(out);
77
}
78
85
bool
second_derivative_impl
(
const
Scalar
x,
Scalar
&out)
const
{
86
out = std::cosh(x);
87
return
std::isfinite(out);
88
}
89
90
};
// class Cosh
91
92
}
// namespace TestSet
93
94
}
// namespace Optimist
95
96
#endif
// OPTIMIST_TESTSET_COSH_HH
Function.hh
OPTIMIST_BASIC_CONSTANTS
#define OPTIMIST_BASIC_CONSTANTS(Scalar)
Definition
Optimist.hh:70
Optimist::FunctionBase< Scalar, Scalar, Cosh< Scalar > >::Scalar
typename InputTrait::Scalar Scalar
Definition
Function.hh:44
Optimist::FunctionBase< Scalar, Scalar, Cosh< Scalar > >::m_guesses
std::vector< Scalar > m_guesses
Definition
Function.hh:85
Optimist::FunctionBase< Scalar, Scalar, Cosh< Scalar > >::m_solutions
std::vector< Scalar > m_solutions
Definition
Function.hh:83
Optimist::Function< Scalar, Scalar, Cosh< Scalar > >::Function
Function()
Definition
Function.hh:236
Optimist::TestSet::Cosh::Cosh
Cosh()
Definition
Cosh.hh:43
Optimist::TestSet::Cosh::name_impl
constexpr std::string name_impl() const
Definition
Cosh.hh:53
Optimist::TestSet::Cosh::evaluate_impl
bool evaluate_impl(const Scalar x, Scalar &out) const
Definition
Cosh.hh:63
Optimist::TestSet::Cosh::first_derivative_impl
bool first_derivative_impl(const Scalar x, Scalar &out) const
Definition
Cosh.hh:74
Optimist::TestSet::Cosh::second_derivative_impl
bool second_derivative_impl(const Scalar x, Scalar &out) const
Definition
Cosh.hh:85
Optimist
Namespace for the Optimist library.
Definition
Optimist.hh:90
core
include
Optimist
TestSet
Cosh.hh
Generated by
1.18.0