33#ifndef GKO_PUBLIC_CORE_STOP_RESIDUAL_NORM_HPP_
34#define GKO_PUBLIC_CORE_STOP_RESIDUAL_NORM_HPP_
40#include <ginkgo/core/base/array.hpp>
41#include <ginkgo/core/base/math.hpp>
42#include <ginkgo/core/base/utils.hpp>
43#include <ginkgo/core/matrix/dense.hpp>
44#include <ginkgo/core/stop/criterion.hpp>
65enum class mode { absolute, initial_resnorm, rhs_norm };
77template <
typename ValueType>
94 device_storage_{exec, 2}
99 absolute_type reduction_factor,
mode baseline);
102 std::unique_ptr<NormVector> starting_tau_{};
103 std::unique_ptr<NormVector> u_dense_tau_{};
108 mode baseline_{mode::rhs_norm};
109 std::shared_ptr<const LinOp> system_matrix_{};
110 std::shared_ptr<const LinOp> b_{};
112 std::shared_ptr<const Vector> one_{};
113 std::shared_ptr<const Vector> neg_one_{};
137template <
typename ValueType = default_precision>
162 explicit ResidualNorm(std::shared_ptr<const gko::Executor> exec)
169 factory->get_parameters().reduction_factor,
170 factory->get_parameters().baseline),
171 parameters_{factory->get_parameters()}
193template <
typename ValueType = default_precision>
233 factory->get_parameters().reduction_factor,
234 factory->get_parameters().baseline),
235 parameters_{factory->get_parameters()}
243GKO_BEGIN_DISABLE_DEPRECATION_WARNINGS
265template <
typename ValueType = default_precision>
267 "Please use the class ResidualNorm with the factory parameter baseline = "
295 factory->get_executor(), args,
296 factory->get_parameters().reduction_factor,
297 mode::initial_resnorm),
298 parameters_{factory->get_parameters()}
321template <
typename ValueType = default_precision>
323 "Please use the class ResidualNorm with the factory parameter baseline = "
351 factory->get_parameters().tolerance,
353 parameters_{factory->get_parameters()}
375template <
typename ValueType = default_precision>
377 "Please use the class ResidualNorm with the factory parameter baseline = "
404 factory->get_parameters().tolerance,
406 parameters_{factory->get_parameters()}
411GKO_END_DISABLE_DEPRECATION_WARNINGS
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition polymorphic_object.hpp:263
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:187
Dense is a matrix format which explicitly stores all values of the matrix.
Definition dense.hpp:136
Definition residual_norm.hpp:393
The AbsoluteResidualNorm class is a stopping criterion which stops the iteration process when the res...
Definition residual_norm.hpp:379
The Updater class serves for convenient argument passing to the Criterion's check function.
Definition criterion.hpp:83
The Criterion class is a base class for all stopping criteria.
Definition criterion.hpp:64
Definition residual_norm.hpp:215
The ImplicitResidualNorm class is a stopping criterion which stops the iteration process when the imp...
Definition residual_norm.hpp:194
Definition residual_norm.hpp:340
The RelativeResidualNorm class is a stopping criterion which stops the iteration process when the res...
Definition residual_norm.hpp:325
The ResidualNormBase class provides a framework for stopping criteria related to the residual norm.
Definition residual_norm.hpp:79
Definition residual_norm.hpp:284
The ResidualNormReduction class is a stopping criterion which stops the iteration process when the re...
Definition residual_norm.hpp:269
Definition residual_norm.hpp:158
The ResidualNorm class is a stopping criterion which stops the iteration process when the actual resi...
Definition residual_norm.hpp:138
#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:308
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition abstract_factory.hpp:473
#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:422
mode
The mode for the residual norm criterion.
Definition residual_norm.hpp:65
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
std::uint8_t uint8
8-bit unsigned integral type.
Definition types.hpp:149
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:354
This struct is used to pass parameters to the EnableDefaultCriterionFactoryCriterionFactory::generate...
Definition criterion.hpp:233