5#ifndef GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
6#define GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
12#include <ginkgo/core/stop/criterion.hpp>
44 std::vector<std::shared_ptr<const CriterionFactory>>
45 GKO_DEFERRED_FACTORY_VECTOR_PARAMETER(
criteria);
51 friend class ::gko::EnablePolymorphicObject<
53 friend class ::gko::enable_parameters_type<parameters_type, Factory>;
60 explicit Factory(std::shared_ptr<const ::gko::Executor> exec);
61 explicit Factory(std::shared_ptr<const ::gko::Executor> exec,
62 const parameters_type& parameters);
72 const parameters_type& get_parameters()
const {
return parameters_; }
75 bool check_impl(
uint8 stoppingId,
bool setFinalized,
77 const Updater&)
override;
79 explicit Combined(std::shared_ptr<const gko::Executor> exec);
81 explicit Combined(
const Factory* factory,
const CriterionArgs& args);
84 friend ::gko::stop::EnableDefaultCriterionFactory<Factory, Combined,
87 parameters_type parameters_;
89 std::vector<std::unique_ptr<Criterion>> criteria_{};
109template <
typename FactoryContainer>
110std::shared_ptr<const CriterionFactory>
combine(FactoryContainer&& factories)
112 switch (factories.size()) {
114 GKO_NOT_SUPPORTED(
nullptr);
116 if (factories[0] ==
nullptr) {
117 GKO_NOT_SUPPORTED(
nullptr);
121 if (factories[0] ==
nullptr) {
123 GKO_NOT_SUPPORTED(
nullptr);
125 auto exec = factories[0]->get_executor();
126 return Combined::build()
127 .with_criteria(std::forward<FactoryContainer>(factories))
The AbstractFactory is a generic interface template that enables easy implementation of the abstract ...
Definition abstract_factory.hpp:47
This mixin provides a default implementation of a concrete factory.
Definition abstract_factory.hpp:126
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:663
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition abstract_factory.hpp:211
Definition combined.hpp:50
The Combined class is used to combine multiple criterions together through an OR operation.
Definition combined.hpp:27
The Criterion class is a base class for all stopping criteria.
Definition criterion.hpp:36
std::shared_ptr< const CriterionFactory > combine(FactoryContainer &&factories)
Combines multiple criterion factories into a single combined criterion factory.
Definition combined.hpp:110
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::uint8_t uint8
8-bit unsigned integral type.
Definition types.hpp:115
@ array
The matrix should be written as dense matrix in column-major order.
Definition combined.hpp:34
std::vector< std::shared_ptr< const CriterionFactory > > criteria
Criterion factories to combine.
Definition combined.hpp:45