33 #ifndef GKO_CORE_LOG_CONVERGENCE_HPP_ 34 #define GKO_CORE_LOG_CONVERGENCE_HPP_ 37 #include <ginkgo/core/log/logger.hpp> 43 #include <ginkgo/core/matrix/dense.hpp> 44 #include <ginkgo/core/stop/criterion.hpp> 67 template <
typename ValueType = default_precision>
72 const LinOp *residual,
const LinOp *residual_norm,
73 const LinOp *solution,
const uint8 &stopping_id,
75 const bool &one_changed,
const bool &all_converged)
const override;
91 static std::unique_ptr<Convergence>
create(
92 std::shared_ptr<const Executor> exec,
95 return std::unique_ptr<Convergence>(
106 return num_iterations_;
123 return residual_norm_.get();
135 std::shared_ptr<const gko::Executor> exec,
137 :
Logger(exec, enabled_events)
142 mutable std::unique_ptr<LinOp> residual_{};
143 mutable std::unique_ptr<LinOp> residual_norm_{};
151 #endif // GKO_CORE_LOG_CONVERGENCE_HPP_ Definition: logger.hpp:90
const LinOp * get_residual_norm() const noexcept
Returns the residual norm.
Definition: convergence.hpp:121
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:94
The Ginkgo namespace.
Definition: abstract_factory.hpp:45
void on_criterion_check_completed(const stop::Criterion *criterion, const size_type &num_iterations, const LinOp *residual, const LinOp *residual_norm, const LinOp *solution, const uint8 &stopping_id, const bool &set_finalized, const Array< stopping_status > *status, const bool &one_changed, const bool &all_converged) const override
stop::Criterion's check completed event.
Definition: lin_op.hpp:134
std::uint8_t uint8
8-bit unsigned integral type.
Definition: types.hpp:123
const size_type & get_num_iterations() const noexcept
Returns the number of iterations.
Definition: convergence.hpp:104
An Array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the Arr...
Definition: array.hpp:63
static constexpr mask_type all_events_mask
Bitset Mask which activates all events.
Definition: logger.hpp:103
The Criterion class is a base class for all stopping criteria.
Definition: criterion.hpp:63
static std::unique_ptr< Convergence > create(std::shared_ptr< const Executor > exec, const mask_type &enabled_events=Logger::all_events_mask)
Creates a convergence logger.
Definition: convergence.hpp:91
const LinOp * get_residual() const noexcept
Returns the residual.
Definition: convergence.hpp:114
Convergence is a Logger which logs data strictly from the criterion_check_completed event...
Definition: convergence.hpp:68