numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
no_jacobian_implicit_kaps_problem.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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
22#include <Eigen/Core>
23
27
28namespace num_prob_collect::ode {
29
51public:
53 using variable_type = Eigen::Vector2d;
54
56 using scalar_type = double;
57
59 using mass_type = Eigen::Matrix2d;
60
62 static constexpr auto allowed_evaluations =
63 num_collect::ode::evaluation_type{.diff_coeff = true, .mass = true};
64
70 explicit no_jacobian_implicit_kaps_problem(double epsilon)
71 : epsilon_(epsilon), mass_({{epsilon_, 0.0}, {0.0, 1.0}}) {}
72
78 void evaluate_on(double /*time*/, const variable_type& variable,
79 num_collect::ode::evaluation_type /*evaluations*/) {
80 diff_coeff_(0) = -(1.0 + 2.0 * epsilon_) * variable(0) + // NOLINT
81 variable(1) * variable(1);
82 diff_coeff_(1) = variable(0) - variable(1) - variable(1) * variable(1);
83 }
84
90 [[nodiscard]] auto diff_coeff() const noexcept -> const variable_type& {
91 return diff_coeff_;
92 }
93
99 [[nodiscard]] auto mass() const noexcept -> const mass_type& {
100 return mass_;
101 }
102
103private:
105 double epsilon_;
106
109
112};
113
115 no_jacobian_implicit_kaps_problem>);
117 no_jacobian_implicit_kaps_problem>);
118
119} // namespace num_prob_collect::ode
Class of Kaps' problem kennedy2003 without Jacobian matrix.
void evaluate_on(double, const variable_type &variable, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
auto mass() const noexcept -> const mass_type &
Get the mass.
auto diff_coeff() const noexcept -> const variable_type &
Get the differential coefficient.
Concept of problems of ordinary differential equations with mass.
Concept of problems of multi-variate ordinary differential equations.
Definition of evaluation_type enumeration.
Definition of mass_problem concept.
Definition of multi_variate_problem concept.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.