Ginkgo  Generated from pipelines/2216270019 branch based on develop. Ginkgo version 1.12.0
A numerical linear algebra library targeting many-core architectures
iteration.hpp
1 // SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_STOP_ITERATION_HPP_
6 #define GKO_PUBLIC_CORE_STOP_ITERATION_HPP_
7 
8 
9 #include <ginkgo/core/base/abstract_factory.hpp>
10 #include <ginkgo/core/stop/criterion.hpp>
11 
12 
13 namespace gko {
14 namespace stop {
15 
25 class Iteration : public EnablePolymorphicObject<Iteration, Criterion> {
27 
28 public:
30  {
35 
36  parameters_type& with_max_iters(size_type value)
37  {
38  this->max_iters = value;
39  return *this;
40  }
41  };
42  GKO_ENABLE_CRITERION_FACTORY(Iteration, parameters, Factory);
44 
45 protected:
46  bool check_impl(uint8 stoppingId, bool setFinalized,
47  array<stopping_status>* stop_status, bool* one_changed,
48  const Updater& updater) override;
49 
50  explicit Iteration(std::shared_ptr<const gko::Executor> exec)
51  : EnablePolymorphicObject<Iteration, Criterion>(std::move(exec))
52  {}
53 
54  explicit Iteration(const Factory* factory, const CriterionArgs& args)
56  factory->get_executor()),
57  parameters_{factory->get_parameters()}
58  {}
59 };
60 
61 
82 deferred_factory_parameter<Iteration::Factory> max_iters(size_type count);
83 
84 
85 } // namespace stop
86 } // namespace gko
87 
88 
89 #endif // GKO_PUBLIC_CORE_STOP_ITERATION_HPP_
gko::stop::CriterionArgs
This struct is used to pass parameters to the EnableDefaultCriterionFactoryCriterionFactory::generate...
Definition: criterion.hpp:205
gko::uint8
std::uint8_t uint8
8-bit unsigned integral type.
Definition: types.hpp:119
gko::stop::Iteration::parameters_type
Definition: iteration.hpp:29
gko::stop::Iteration
The Iteration class is a stopping criterion which stops the iteration process after a preset number o...
Definition: iteration.hpp:25
gko::size_type
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:90
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
gko::stop::max_iters
deferred_factory_parameter< Iteration::Factory > max_iters(size_type count)
Creates the precursor to an Iteration stopping criterion factory, to be used in conjunction with ....
gko::array
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition: array.hpp:26
gko::stop::Iteration::Factory
Definition: iteration.hpp:42
gko::stop::Criterion
The Criterion class is a base class for all stopping criteria.
Definition: criterion.hpp:36
GKO_ENABLE_BUILD_METHOD
#define GKO_ENABLE_BUILD_METHOD(_factory_name)
Defines a build method for the factory, simplifying its construction by removing the repetitive typin...
Definition: abstract_factory.hpp:394
GKO_CREATE_FACTORY_PARAMETERS
#define GKO_CREATE_FACTORY_PARAMETERS(_parameters_name, _factory_name)
This Macro will generate a new type containing the parameters for the factory _factory_name.
Definition: abstract_factory.hpp:280
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition: polymorphic_object.hpp:667