5#ifndef GKO_PUBLIC_CORE_STOP_RESIDUAL_NORM_HPP_
6#define GKO_PUBLIC_CORE_STOP_RESIDUAL_NORM_HPP_
12#include <ginkgo/core/base/array.hpp>
13#include <ginkgo/core/base/math.hpp>
14#include <ginkgo/core/base/utils.hpp>
15#include <ginkgo/core/matrix/dense.hpp>
16#include <ginkgo/core/stop/criterion.hpp>
37enum class mode { absolute, initial_resnorm, rhs_norm };
49template <
typename ValueType>
60 bool check_impl(
uint8 stoppingId,
bool setFinalized,
66 device_storage_{exec, 2}
71 absolute_type reduction_factor,
mode baseline);
74 std::unique_ptr<NormVector> starting_tau_{};
75 std::unique_ptr<NormVector> u_dense_tau_{};
80 mode baseline_{mode::rhs_norm};
81 std::shared_ptr<const LinOp> system_matrix_{};
82 std::shared_ptr<const LinOp> b_{};
84 std::shared_ptr<const Vector> one_{};
85 std::shared_ptr<const Vector> neg_one_{};
109template <
typename ValueType = default_precision>
134 explicit ResidualNorm(std::shared_ptr<const gko::Executor> exec)
140 factory->get_executor(), args,
141 factory->get_parameters().reduction_factor,
142 factory->get_parameters().baseline),
143 parameters_{factory->get_parameters()}
165template <
typename ValueType = default_precision>
193 bool check_impl(
uint8 stoppingId,
bool setFinalized,
204 factory->get_executor(), args,
205 factory->get_parameters().reduction_factor,
206 factory->get_parameters().baseline),
207 parameters_{factory->get_parameters()}
215GKO_BEGIN_DISABLE_DEPRECATION_WARNINGS
237template <
typename ValueType = default_precision>
239 "Please use the class ResidualNorm with the factory parameter baseline = "
267 factory->get_executor(), args,
268 factory->get_parameters().reduction_factor,
269 mode::initial_resnorm),
270 parameters_{factory->get_parameters()}
293template <
typename ValueType = default_precision>
295 "Please use the class ResidualNorm with the factory parameter baseline = "
323 factory->get_parameters().tolerance,
325 parameters_{factory->get_parameters()}
347template <
typename ValueType = default_precision>
349 "Please use the class ResidualNorm with the factory parameter baseline = "
376 factory->get_parameters().tolerance,
378 parameters_{factory->get_parameters()}
383GKO_END_DISABLE_DEPRECATION_WARNINGS
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:663
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition logger.hpp:25
Dense is a matrix format which explicitly stores all values of the matrix.
Definition sparsity_csr.hpp:26
Definition residual_norm.hpp:365
The AbsoluteResidualNorm class is a stopping criterion which stops the iteration process when the res...
Definition residual_norm.hpp:351
The Updater class serves for convenient argument passing to the Criterion's check function.
Definition criterion.hpp:55
The Criterion class is a base class for all stopping criteria.
Definition criterion.hpp:36
Definition residual_norm.hpp:187
The ImplicitResidualNorm class is a stopping criterion which stops the iteration process when the imp...
Definition residual_norm.hpp:166
Definition residual_norm.hpp:312
The RelativeResidualNorm class is a stopping criterion which stops the iteration process when the res...
Definition residual_norm.hpp:297
The ResidualNormBase class provides a framework for stopping criteria related to the residual norm.
Definition residual_norm.hpp:51
Definition residual_norm.hpp:256
The ResidualNormReduction class is a stopping criterion which stops the iteration process when the re...
Definition residual_norm.hpp:241
Definition residual_norm.hpp:130
The ResidualNorm class is a stopping criterion which stops the iteration process when the actual resi...
Definition residual_norm.hpp:110
#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
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition abstract_factory.hpp:445
#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
mode
The mode for the residual norm criterion.
Definition residual_norm.hpp:37
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::uint8_t uint8
8-bit unsigned integral type.
Definition types.hpp:115
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition math.hpp:326
This struct is used to pass parameters to the EnableDefaultCriterionFactoryCriterionFactory::generate...
Definition criterion.hpp:205