5#ifndef GKO_PUBLIC_CORE_MATRIX_DIAGONAL_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_DIAGONAL_HPP_
9#include <ginkgo/core/base/array.hpp>
10#include <ginkgo/core/base/lin_op.hpp>
17template <
typename ValueType,
typename IndexType>
20template <
typename ValueType>
38template <
typename ValueType = default_precision>
45 public ConvertibleTo<Diagonal<next_precision<next_precision<ValueType>>>>,
68 using value_type = ValueType;
69 using index_type =
int64;
76 friend class Diagonal<previous_precision<ValueType>>;
87 friend class Diagonal<previous_precision<previous_precision<ValueType>>>;
140 GKO_ASSERT_REVERSE_CONFORMANT(
this, b);
141 GKO_ASSERT_EQUAL_ROWS(b, x);
142 GKO_ASSERT_EQUAL_COLS(
this, x);
144 this->rapply_impl(b.
get(), x.
get());
158 GKO_ASSERT_CONFORMANT(
this, b);
159 GKO_ASSERT_EQUAL_ROWS(b, x);
160 GKO_ASSERT_EQUAL_ROWS(
this, x);
162 this->inverse_apply_impl(b.
get(), x.
get());
165 void read(
const mat_data& data)
override;
167 void read(
const mat_data32& data)
override;
169 void read(
const device_mat_data& data)
override;
171 void read(
const device_mat_data32& data)
override;
173 void read(device_mat_data&& data)
override;
175 void read(device_mat_data32&& data)
override;
177 void write(mat_data& data)
const override;
179 void write(mat_data32& data)
const override;
190 std::shared_ptr<const Executor> exec,
size_type size = 0);
207 std::shared_ptr<const Executor> exec,
const size_type size,
214 template <
typename InputValueType>
216 "explicitly construct the gko::array argument instead of passing an"
220 std::initializer_list<InputValueType> values)
236 std::shared_ptr<const Executor> exec,
size_type size,
237 gko::detail::const_array_view<ValueType>&& values);
245 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
248 LinOp* x)
const override;
250 void rapply_impl(
const LinOp* b,
LinOp* x)
const;
252 void inverse_apply_impl(
const LinOp* b,
LinOp* x)
const;
Definition polymorphic_object.hpp:479
Definition lin_op.hpp:793
Definition lin_op.hpp:878
Definition polymorphic_object.hpp:668
Definition executor.hpp:615
Definition lin_op.hpp:117
Definition lin_op.hpp:605
Definition lin_op.hpp:433
Definition lin_op.hpp:660
value_type * get_data() noexcept
Definition array.hpp:673
const value_type * get_const_data() const noexcept
Definition array.hpp:682
Definition device_matrix_data.hpp:36
Definition diagonal.hpp:52
static std::unique_ptr< const Diagonal > create_const(std::shared_ptr< const Executor > exec, size_type size, gko::detail::const_array_view< ValueType > &&values)
void rapply(ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Definition diagonal.hpp:138
static std::unique_ptr< Diagonal > create(std::shared_ptr< const Executor > exec, size_type size=0)
void inverse_apply(ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Definition diagonal.hpp:156
value_type * get_values() noexcept
Definition diagonal.hpp:117
std::unique_ptr< LinOp > conj_transpose() const override
static std::unique_ptr< Diagonal > create(std::shared_ptr< const Executor > exec, const size_type size, array< value_type > values)
std::unique_ptr< absolute_type > compute_absolute() const override
const value_type * get_const_values() const noexcept
Definition diagonal.hpp:126
void compute_absolute_inplace() override
std::unique_ptr< LinOp > transpose() const override
Definition utils_helper.hpp:41
T * get() const
Definition utils_helper.hpp:75
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::int32_t int32
Definition types.hpp:106
typename detail::next_precision_impl< T >::type next_precision
Definition math.hpp:438
std::int64_t int64
Definition types.hpp:112
std::size_t size_type
Definition types.hpp:89
typename detail::to_complex_s< T >::type to_complex
Definition math.hpp:279
typename detail::remove_complex_s< T >::type remove_complex
Definition math.hpp:260
Definition matrix_data.hpp:126