Optimist  0.0.0
A C++ library for optimization
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
18namespace 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:
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
#define OPTIMIST_BASIC_CONSTANTS(Scalar)
Definition Optimist.hh:70
typename InputTrait::Scalar Scalar
Definition Function.hh:53
std::vector< Scalar > m_guesses
Definition Function.hh:79
std::vector< Scalar > m_solutions
Definition Function.hh:77
constexpr std::string name_impl() const
Definition Sinh.hh:52
bool first_derivative_impl(const Scalar x, Scalar &out) const
Definition Sinh.hh:73
bool evaluate_impl(const Scalar x, Scalar &out) const
Definition Sinh.hh:62
Sinh()
Definition Sinh.hh:42
bool second_derivative_impl(const Scalar x, Scalar &out) const
Definition Sinh.hh:84
Namespace for the Optimist library.
Definition Optimist.hh:90