numerical-collection-cpp
0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
cubic_root_test_function.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
22
namespace
num_prob_collect::roots
{
23
27
class
cubic_root_test_function
{
28
public
:
30
using
variable_type
= double;
31
33
using
jacobian_type
= double;
34
40
explicit
cubic_root_test_function
(
variable_type
target) :
target_
(target) {}
41
47
void
evaluate_on
(
const
variable_type
& variable) {
48
value_
= variable * variable * variable -
target_
;
49
jacobian_
= 3.0 * variable * variable;
// NOLINT
50
}
51
57
[[nodiscard]]
auto
value
() const noexcept -> const
variable_type
& {
58
return
value_
;
59
}
60
66
[[nodiscard]]
auto
jacobian
() const noexcept -> const
jacobian_type
& {
67
return
jacobian_
;
68
}
69
70
private
:
72
variable_type
target_
;
73
75
variable_type
value_
{};
76
78
jacobian_type
jacobian_
{};
79
};
80
81
}
// namespace num_prob_collect::roots
num_prob_collect::roots::cubic_root_test_function
Class of test function to calculate cubic root of a number.
Definition
cubic_root_test_function.h:27
num_prob_collect::roots::cubic_root_test_function::evaluate_on
void evaluate_on(const variable_type &variable)
Evaluate on a variable.
Definition
cubic_root_test_function.h:47
num_prob_collect::roots::cubic_root_test_function::jacobian_
jacobian_type jacobian_
Jacobian matrix.
Definition
cubic_root_test_function.h:78
num_prob_collect::roots::cubic_root_test_function::variable_type
double variable_type
Type of variables.
Definition
cubic_root_test_function.h:30
num_prob_collect::roots::cubic_root_test_function::cubic_root_test_function
cubic_root_test_function(variable_type target)
Constructor.
Definition
cubic_root_test_function.h:40
num_prob_collect::roots::cubic_root_test_function::jacobian_type
double jacobian_type
Type of Jacobian.
Definition
cubic_root_test_function.h:33
num_prob_collect::roots::cubic_root_test_function::value_
variable_type value_
Function value.
Definition
cubic_root_test_function.h:75
num_prob_collect::roots::cubic_root_test_function::target_
variable_type target_
Value to calculate cubic root of.
Definition
cubic_root_test_function.h:72
num_prob_collect::roots::cubic_root_test_function::jacobian
auto jacobian() const noexcept -> const jacobian_type &
Get Jacobian matrix.
Definition
cubic_root_test_function.h:66
num_prob_collect::roots::cubic_root_test_function::value
auto value() const noexcept -> const variable_type &
Get function value.
Definition
cubic_root_test_function.h:57
num_prob_collect::roots
Namespace of root-finding problems.
Definition
namespaces.h:31
problems
include
num_prob_collect
roots
cubic_root_test_function.h
Generated on Sat Jan 18 2025 03:47:34 for numerical-collection-cpp by
1.12.0