numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
explicit_param_searcher_base.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
25
33template <typename Derived, concepts::explicit_regularized_solver Solver>
35public:
37 using solver_type = Solver;
38
40 using scalar_type = typename solver_type::scalar_type;
41
43 using data_type = typename solver_type::data_type;
44
48 void search() { derived().search(); }
49
55 [[nodiscard]] auto opt_param() const -> scalar_type {
56 return derived().opt_param();
57 }
58
65 void solve(data_type& solution) const { derived().solve(solution); }
66
67protected:
73 [[nodiscard]] auto derived() noexcept -> Derived& {
74 return *static_cast<Derived*>(this);
75 }
76
82 [[nodiscard]] auto derived() const noexcept -> const Derived& {
83 return *static_cast<const Derived*>(this);
84 }
85};
86
87} // namespace num_collect::regularization
Base class for searching the optimal regularization parameters using explicit formulas for regulariza...
auto opt_param() const -> scalar_type
Get the optimal regularization parameter.
void solve(data_type &solution) const
Solver with the optimal regularization parameter.
auto derived() const noexcept -> const Derived &
Access derived object.
void search()
Search the optimal regularization parameter.
auto derived() noexcept -> Derived &
Access derived object.
typename solver_type::scalar_type scalar_type
Type of scalars.
Definition of explicit_regularized_solver concept.
Namespace of regularization algorithms.