numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
exponential_problem.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
23
24namespace num_prob_collect::ode {
25
30public:
32 using variable_type = double;
33
35 using scalar_type = double;
36
38 using jacobian_type = double;
39
41 static constexpr auto allowed_evaluations =
42 num_collect::ode::evaluation_type{.diff_coeff = true, .jacobian = true};
43
49 void evaluate_on(double /*time*/, double variable,
50 num_collect::ode::evaluation_type /*evaluations*/) {
51 diff_coeff_ = variable;
52 }
53
59 [[nodiscard]] auto diff_coeff() const -> const double& {
60 return diff_coeff_;
61 }
62
68 [[nodiscard]] auto jacobian() const noexcept -> const jacobian_type& {
69 return jacobian_;
70 }
71
72private:
74 double diff_coeff_{};
75
77 double jacobian_{1.0};
78};
79
80} // namespace num_prob_collect::ode
Class of test problem to calculate exponential function.
auto diff_coeff() const -> const double &
Get the differential coefficient.
double diff_coeff_
Differential coefficient.
static constexpr auto allowed_evaluations
Allowed evaluations.
auto jacobian() const noexcept -> const jacobian_type &
Get the Jacobian.
void evaluate_on(double, double variable, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
Definition of evaluation_type enumeration.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.