Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Cosh.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco, Mattia Piazza and Enrico Bertolazzi. *
3 * *
4 * The Optimist project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Mattia Piazza Enrico Bertolazzi *
7 * University of Trento University of Trento University of Trento *
8 * davide.stocco@unitn.it mattia.piazza@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/TestSet.hh"
17
18namespace Optimist
19{
20
21 namespace TestSet
22 {
23
35 template <typename Real>
36 class Cosh : public Function<Real, 1, 1, Cosh<Real>>
37 {
38 public:
40
41
45 {
46 this->m_solutions.emplace_back(0.0); // Minimum
47 this->m_guesses.emplace_back(-10.0);
48 this->m_guesses.emplace_back(10.0);
49 }
50
55 std::string name_impl() const {return "Cosh";}
56
63 bool evaluate_impl(Real x, Real & out) const
64 {
65 out = std::cosh(x);
66 return std::isfinite(out);
67 }
68
75 bool first_derivative_impl(Real x, Real & out) const
76 {
77 out = std::sinh(x);
78 return std::isfinite(out);
79 }
80
87 bool second_derivative_impl(Real x, Real & out) const
88 {
89 out = std::cosh(x);
90 return std::isfinite(out);
91 }
92
93 }; // class Cosh
94
95 } // namespace TestSet
96
97} // namespace Optimist
98
99#endif // OPTIMIST_TESTSET_COSH_HH
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:71
std::vector< InputType > m_guesses
Definition Function.hh:66
std::vector< InputType > m_solutions
Definition Function.hh:65
std::string name_impl() const
Definition Cosh.hh:55
Cosh()
Definition Cosh.hh:44
bool second_derivative_impl(Real x, Real &out) const
Definition Cosh.hh:87
bool evaluate_impl(Real x, Real &out) const
Definition Cosh.hh:63
bool first_derivative_impl(Real x, Real &out) const
Definition Cosh.hh:75
Namespace for the Optimist library.
Definition Optimist.hh:88