NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
Iteration.hpp
Go to the documentation of this file.
1
33#pragma once
34
36#include "NumCpp/Core/Types.hpp"
37
38namespace nc::roots
39{
40 //================================================================================
41 // Class Description:
44 {
45 public:
46 //============================================================================
47 // Method Description:
52 explicit Iteration(double epsilon) noexcept :
53 epsilon_(epsilon)
54 {
55 }
56
57 //============================================================================
58 // Method Description:
64 Iteration(double epsilon, uint32 maxNumIterations) noexcept :
65 epsilon_(epsilon),
66 maxNumIterations_(maxNumIterations)
67 {
68 }
69
70 //============================================================================
71 // Method Description:
74 virtual ~Iteration() noexcept = default;
75
76 //============================================================================
77 // Method Description:
82 [[nodiscard]] uint32 numIterations() const noexcept
83 {
84 return numIterations_;
85 }
86
87 protected:
88 //============================================================================
89 // Method Description:
93 {
95 }
96
97 //============================================================================
98 // Method Description:
102 {
105 {
107 "Maximum number of iterations has been reached; no root has been found within epsilon.");
108 }
109 }
110
111 //====================================Attributes==============================
112 const double epsilon_;
115 };
116} // namespace nc::roots
#define THROW_RUNTIME_ERROR(msg)
Definition Error.hpp:40
Iteration(double epsilon) noexcept
Definition Iteration.hpp:52
virtual ~Iteration() noexcept=default
const double epsilon_
Definition Iteration.hpp:112
Iteration(double epsilon, uint32 maxNumIterations) noexcept
Definition Iteration.hpp:64
uint32 numIterations_
Definition Iteration.hpp:114
void resetNumberOfIterations() noexcept
Definition Iteration.hpp:92
uint32 maxNumIterations_
Definition Iteration.hpp:113
uint32 numIterations() const noexcept
Definition Iteration.hpp:82
void incrementNumberOfIterations()
Definition Iteration.hpp:101
Definition Bisection.hpp:43
std::uint32_t uint32
Definition Types.hpp:40