33#ifndef GKO_PUBLIC_CORE_STOP_STOPPING_STATUS_HPP_
34#define GKO_PUBLIC_CORE_STOP_STOPPING_STATUS_HPP_
37#include <ginkgo/core/base/array.hpp>
38#include <ginkgo/core/base/types.hpp>
50 friend GKO_ATTRIBUTES GKO_INLINE
bool operator==(
52 friend GKO_ATTRIBUTES GKO_INLINE
bool operator!=(
71 return data_ & converged_mask_;
81 return data_ & finalized_mask_;
90 return data_ & id_mask_;
109 data_ |= (
id & id_mask_);
111 data_ |= finalized_mask_;
126 data_ |= converged_mask_ | (
id & id_mask_);
128 data_ |= finalized_mask_;
140 data_ |= finalized_mask_;
145 static constexpr uint8 converged_mask_ =
uint8{1} << 7;
146 static constexpr uint8 finalized_mask_ =
uint8{1} << 6;
165 return x.data_ == y.data_;
180 return x.data_ != y.data_;
This class is used to keep track of the stopping status of one vector.
Definition stopping_status.hpp:49
void finalize() noexcept
Set the result to be finalized (it needs to be stopped or converged first).
Definition stopping_status.hpp:137
void converge(uint8 id, bool set_finalized=true) noexcept
Call if convergence occurred.
Definition stopping_status.hpp:122
friend bool operator!=(const stopping_status &x, const stopping_status &y) noexcept
Checks if two stopping statuses are different.
Definition stopping_status.hpp:177
bool is_finalized() const noexcept
Check if the corresponding vector stores the finalized result.
Definition stopping_status.hpp:79
friend bool operator==(const stopping_status &x, const stopping_status &y) noexcept
Checks if two stopping statuses are equivalent.
Definition stopping_status.hpp:162
bool has_converged() const noexcept
Check if convergence was reached.
Definition stopping_status.hpp:69
void stop(uint8 id, bool set_finalized=true) noexcept
Call if a stop occurred due to a hard limit (and convergence was not reached).
Definition stopping_status.hpp:105
uint8 get_id() const noexcept
Get the id of the stopping criterion which caused the stop.
Definition stopping_status.hpp:88
bool has_stopped() const noexcept
Check if any stopping criteria was fulfilled.
Definition stopping_status.hpp:60
void reset() noexcept
Clear all flags.
Definition stopping_status.hpp:96
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
constexpr bool operator!=(const dim< Dimensionality, DimensionType > &x, const dim< Dimensionality, DimensionType > &y)
Checks if two dim objects are different.
Definition dim.hpp:258