Ginkgo  Generated from pipelines/2969282958 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
lin_op.hpp
1 // SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_BASE_LIN_OP_HPP_
6 #define GKO_PUBLIC_CORE_BASE_LIN_OP_HPP_
7 
8 
9 #include <memory>
10 #include <type_traits>
11 #include <utility>
12 
13 #include <ginkgo/core/base/abstract_factory.hpp>
14 #include <ginkgo/core/base/device_matrix_data.hpp>
15 #include <ginkgo/core/base/dim.hpp>
16 #include <ginkgo/core/base/exception_helpers.hpp>
17 #include <ginkgo/core/base/math.hpp>
18 #include <ginkgo/core/base/matrix_assembly_data.hpp>
19 #include <ginkgo/core/base/matrix_data.hpp>
20 #include <ginkgo/core/base/polymorphic_object.hpp>
21 #include <ginkgo/core/base/types.hpp>
22 #include <ginkgo/core/base/utils.hpp>
23 #include <ginkgo/core/log/logger.hpp>
24 
25 
26 namespace gko {
27 namespace matrix {
28 
29 
30 template <typename ValueType>
31 class Diagonal;
32 
33 
34 } // namespace matrix
35 
36 
117 class LinOp : public PolymorphicObject {
118 public:
128  {
129  this->template log<log::Logger::linop_apply_started>(this, b.get(),
130  x.get());
131  this->validate_application_parameters(b.get(), x.get());
132  auto exec = this->get_executor();
133  this->apply_impl(make_temporary_clone(exec, b).get(),
134  make_temporary_clone(exec, x).get());
135  this->template log<log::Logger::linop_apply_completed>(this, b.get(),
136  x.get());
137  }
138 
139 
150  {
151  this->template log<log::Logger::linop_advanced_apply_started>(
152  this, alpha.get(), b.get(), beta.get(), x.get());
153  this->validate_application_parameters(alpha.get(), b.get(), beta.get(),
154  x.get());
155  auto exec = this->get_executor();
156  this->apply_impl(make_temporary_clone(exec, alpha).get(),
157  make_temporary_clone(exec, b).get(),
158  make_temporary_clone(exec, beta).get(),
159  make_temporary_clone(exec, x).get());
160  this->template log<log::Logger::linop_advanced_apply_completed>(
161  this, alpha.get(), b.get(), beta.get(), x.get());
162  }
163 
169  const dim<2>& get_size() const noexcept { return size_; }
170 
178  virtual bool apply_uses_initial_guess() const { return false; }
179 
181  LinOp& operator=(const LinOp&) = default;
182 
189  {
190  if (this != &other) {
191  PolymorphicObject::operator=(std::move(other));
192  this->set_size(other.get_size());
193  other.set_size({});
194  }
195  return *this;
196  }
197 
199  LinOp(const LinOp&) = default;
200 
205  LinOp(LinOp&& other)
206  : PolymorphicObject(std::move(other)),
207  size_{std::exchange(other.size_, dim<2>{})}
208  {}
209 
210 protected:
217  explicit LinOp(std::shared_ptr<const Executor> exec,
218  const dim<2>& size = dim<2>{})
219  : PolymorphicObject(exec), size_{size}
220  {}
221 
227  void set_size(const dim<2>& value) noexcept { size_ = value; }
228 
238  virtual void apply_impl(const LinOp* b, LinOp* x) const = 0;
239 
249  virtual void apply_impl(const LinOp* alpha, const LinOp* b,
250  const LinOp* beta, LinOp* x) const = 0;
251 
259  void validate_application_parameters(const LinOp* b, const LinOp* x) const
260  {
261  GKO_ASSERT_CONFORMANT(this, b);
262  GKO_ASSERT_EQUAL_ROWS(this, x);
263  GKO_ASSERT_EQUAL_COLS(b, x);
264  }
265 
275  void validate_application_parameters(const LinOp* alpha, const LinOp* b,
276  const LinOp* beta,
277  const LinOp* x) const
278  {
279  this->validate_application_parameters(b, x);
280  GKO_ASSERT_EQUAL_DIMENSIONS(alpha, dim<2>(1, 1));
281  GKO_ASSERT_EQUAL_DIMENSIONS(beta, dim<2>(1, 1));
282  }
283 
284 private:
285  dim<2> size_{};
286 };
287 
288 
345 public:
346  using AbstractFactory::AbstractFactory;
347 
348  std::unique_ptr<LinOp> generate(std::shared_ptr<const LinOp> input) const
349  {
350  this->template log<log::Logger::linop_factory_generate_started>(
351  this, input.get());
352  const auto exec = this->get_executor();
353  std::unique_ptr<LinOp> generated;
354  if (input->get_executor() == exec) {
355  generated = this->AbstractFactory::generate(input);
356  } else {
357  generated =
358  this->AbstractFactory::generate(gko::clone(exec, input));
359  }
360  this->template log<log::Logger::linop_factory_generate_completed>(
361  this, input.get(), generated.get());
362  return generated;
363  }
364 
371  class ReuseData {
372  public:
373  ReuseData();
374 
375  virtual ~ReuseData();
376 
377  ReuseData(const ReuseData&) = delete;
378 
379  ReuseData(ReuseData&&) = delete;
380 
381  ReuseData& operator=(const ReuseData&) = delete;
382 
383  ReuseData& operator=(ReuseData&&) = delete;
384  };
385 
390  virtual std::unique_ptr<ReuseData> create_empty_reuse_data() const;
391 
432  std::unique_ptr<LinOp> generate_reuse(std::shared_ptr<const LinOp> input,
433  ReuseData& reuse_data) const;
434 
447  virtual void check_reuse_consistent(const LinOp* input,
448  const ReuseData& reuse_data) const;
449 
450 protected:
462  virtual std::unique_ptr<LinOp> generate_reuse_impl(
463  std::shared_ptr<const LinOp> input, ReuseData& reuse_data) const;
464 };
465 
466 
493 public:
494  virtual ~Transposable() = default;
495 
501  virtual std::unique_ptr<LinOp> transpose() const = 0;
502 
509  virtual std::unique_ptr<LinOp> conj_transpose() const = 0;
510 };
511 
512 
542 template <typename IndexType>
543 class Permutable {
544 public:
545  virtual ~Permutable() = default;
546 
561  virtual std::unique_ptr<LinOp> permute(
562  const array<IndexType>* permutation_indices) const
563  {
564  return as<Permutable>(this->row_permute(permutation_indices))
565  ->column_permute(permutation_indices);
566  }
567 
582  virtual std::unique_ptr<LinOp> inverse_permute(
583  const array<IndexType>* permutation_indices) const
584  {
585  return as<Permutable>(this->inverse_row_permute(permutation_indices))
586  ->inverse_column_permute(permutation_indices);
587  }
588 
602  virtual std::unique_ptr<LinOp> row_permute(
603  const array<IndexType>* permutation_indices) const = 0;
604 
619  virtual std::unique_ptr<LinOp> column_permute(
620  const array<IndexType>* permutation_indices) const = 0;
621 
635  virtual std::unique_ptr<LinOp> inverse_row_permute(
636  const array<IndexType>* permutation_indices) const = 0;
637 
652  virtual std::unique_ptr<LinOp> inverse_column_permute(
653  const array<IndexType>* permutation_indices) const = 0;
654 };
655 
656 
663 template <typename ValueType, typename IndexType>
665 public:
666  using value_type = ValueType;
667  using index_type = IndexType;
668 
669  virtual ~ReadableFromMatrixData() = default;
670 
676  virtual void read(const matrix_data<ValueType, IndexType>& data) = 0;
677 
684  {
685  this->read(data.get_ordered_data());
686  }
687 
694  {
695  this->read(data.copy_to_host());
696  }
697 
705  {
706  this->read(data.copy_to_host());
707  data.empty_out();
708  }
709 };
710 
711 
718 template <typename ValueType, typename IndexType>
720 public:
721  using value_type = ValueType;
722  using index_type = IndexType;
723 
724  virtual ~WritableToMatrixData() = default;
725 
731  virtual void write(matrix_data<ValueType, IndexType>& data) const = 0;
732 
743  {
745  this->write(host_data);
747  data.get_executor(), host_data);
748  }
749 };
750 
751 
759 public:
760  virtual ~Preconditionable() = default;
761 
767  virtual std::shared_ptr<const LinOp> get_preconditioner() const
768  {
769  return preconditioner_;
770  }
771 
778  virtual void set_preconditioner(std::shared_ptr<const LinOp> new_precond)
779  {
780  preconditioner_ = new_precond;
781  }
782 
783 private:
784  std::shared_ptr<const LinOp> preconditioner_{};
785 };
786 
787 
798 public:
799  virtual ~DiagonalLinOpExtractable() = default;
800 
806  virtual std::unique_ptr<LinOp> extract_diagonal_linop() const = 0;
807 };
808 
809 
817 template <typename ValueType>
819 public:
820  using value_type = ValueType;
821 
822  virtual ~DiagonalExtractable() = default;
823 
824  std::unique_ptr<LinOp> extract_diagonal_linop() const override;
825 
831  virtual std::unique_ptr<matrix::Diagonal<ValueType>> extract_diagonal()
832  const = 0;
833 };
834 
835 
842 public:
843  virtual ~AbsoluteComputable() = default;
844 
850  virtual std::unique_ptr<LinOp> compute_absolute_linop() const = 0;
851 
855  virtual void compute_absolute_inplace() = 0;
856 };
857 
858 
870 template <typename AbsoluteLinOp>
872 public:
873  using absolute_type = AbsoluteLinOp;
874 
875  virtual ~EnableAbsoluteComputation() = default;
876 
877  std::unique_ptr<LinOp> compute_absolute_linop() const override
878  {
879  return this->compute_absolute();
880  }
881 
887  virtual std::unique_ptr<absolute_type> compute_absolute() const = 0;
888 };
889 
890 
896 public:
897  virtual ~ScaledIdentityAddable() = default;
898 
907  ptr_param<const LinOp> const b)
908  {
909  GKO_ASSERT_IS_SCALAR(a);
910  GKO_ASSERT_IS_SCALAR(b);
911  auto ae = make_temporary_clone(as<LinOp>(this)->get_executor(), a);
912  auto be = make_temporary_clone(as<LinOp>(this)->get_executor(), b);
913  add_scaled_identity_impl(ae.get(), be.get());
914  }
915 
916 private:
917  virtual void add_scaled_identity_impl(const LinOp* a, const LinOp* b) = 0;
918 };
919 
920 
938 template <typename ConcreteFactory, typename ConcreteLinOp,
939  typename ParametersType, typename PolymorphicBase = LinOpFactory>
941  EnableDefaultFactory<ConcreteFactory, ConcreteLinOp, ParametersType,
942  PolymorphicBase>;
943 
944 
965 template <typename ConcreteFactory, typename ConcreteLinOp,
966  typename ParametersType, typename ReuseDataType,
967  typename PolymorphicBase = LinOpFactory>
969  : public EnableDefaultLinOpFactory<ConcreteFactory, ConcreteLinOp,
970  ParametersType, PolymorphicBase> {
971  using base_type =
972  EnableDefaultLinOpFactory<ConcreteFactory, ConcreteLinOp,
973  ParametersType, PolymorphicBase>;
974 
975 public:
977  std::unique_ptr<ConcreteLinOp> generate_reuse(
978  std::shared_ptr<const LinOp> input,
979  LinOpFactory::ReuseData& reuse_data) const
980  {
981  return std::unique_ptr<ConcreteLinOp>(static_cast<ConcreteLinOp*>(
982  this->LinOpFactory::generate_reuse(std::move(input), reuse_data)
983  .release()));
984  }
985 
986  std::unique_ptr<LinOpFactory::ReuseData> create_empty_reuse_data()
987  const override
988  {
989  return std::make_unique<ReuseDataType>();
990  }
991 
992  void check_reuse_consistent(
993  const LinOp* input,
994  const LinOpFactory::ReuseData& reuse_data) const override
995  {
996  ConcreteLinOp::check_reuse_consistent(
997  static_cast<const ConcreteFactory*>(this), input,
998  *as<ReuseDataType>(&reuse_data));
999  }
1000 
1001 protected:
1002  explicit EnableDefaultReusableLinOpFactory(
1003  std::shared_ptr<const Executor> exec,
1004  const ParametersType& parameters = {})
1005  : base_type(std::move(exec), parameters)
1006  {}
1007 
1008  std::unique_ptr<LinOp> generate_reuse_impl(
1009  std::shared_ptr<const LinOp> input,
1010  LinOpFactory::ReuseData& reuse_data) const override
1011  {
1012  return std::unique_ptr<LinOp>(new ConcreteLinOp(
1013  static_cast<const ConcreteFactory*>(this), std::move(input),
1014  *as<ReuseDataType>(&reuse_data)));
1015  }
1016 };
1017 
1018 
1094 #define GKO_ENABLE_LIN_OP_FACTORY(_lin_op, _parameters_name, _factory_name) \
1095 public: \
1096  const _parameters_name##_type& get_##_parameters_name() const \
1097  { \
1098  return _parameters_name##_; \
1099  } \
1100  \
1101  class _factory_name \
1102  : public ::gko::EnableDefaultLinOpFactory<_factory_name, _lin_op, \
1103  _parameters_name##_type> { \
1104  friend class ::gko::enable_parameters_type<_parameters_name##_type, \
1105  _factory_name>; \
1106  explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec) \
1107  : ::gko::EnableDefaultLinOpFactory<_factory_name, _lin_op, \
1108  _parameters_name##_type>( \
1109  std::move(exec)) \
1110  {} \
1111  explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec, \
1112  const _parameters_name##_type& parameters) \
1113  : ::gko::EnableDefaultLinOpFactory<_factory_name, _lin_op, \
1114  _parameters_name##_type>( \
1115  std::move(exec), parameters) \
1116  {} \
1117  }; \
1118  friend ::gko::EnableDefaultLinOpFactory<_factory_name, _lin_op, \
1119  _parameters_name##_type>; \
1120  \
1121  \
1122 private: \
1123  _parameters_name##_type _parameters_name##_; \
1124  \
1125 public: \
1126  static_assert(true, \
1127  "This assert is used to counter the false positive extra " \
1128  "semi-colon warnings")
1129 
1130 
1167 #define GKO_ENABLE_LIN_OP_FACTORY_WITH_REUSE(_lin_op, _parameters_name, \
1168  _factory_name, _reuse_data_type) \
1169 public: \
1170  const _parameters_name##_type& get_##_parameters_name() const \
1171  { \
1172  return _parameters_name##_; \
1173  } \
1174  \
1175  class _factory_name : public ::gko::EnableDefaultReusableLinOpFactory< \
1176  _factory_name, _lin_op, _parameters_name##_type, \
1177  _reuse_data_type> { \
1178  friend class ::gko::enable_parameters_type<_parameters_name##_type, \
1179  _factory_name>; \
1180  explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec) \
1181  : ::gko::EnableDefaultReusableLinOpFactory< \
1182  _factory_name, _lin_op, _parameters_name##_type, \
1183  _reuse_data_type>(std::move(exec)) \
1184  {} \
1185  explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec, \
1186  const _parameters_name##_type& parameters) \
1187  : ::gko::EnableDefaultReusableLinOpFactory< \
1188  _factory_name, _lin_op, _parameters_name##_type, \
1189  _reuse_data_type>(std::move(exec), parameters) \
1190  {} \
1191  }; \
1192  friend ::gko::EnableDefaultLinOpFactory<_factory_name, _lin_op, \
1193  _parameters_name##_type>; \
1194  friend ::gko::EnableDefaultReusableLinOpFactory< \
1195  _factory_name, _lin_op, _parameters_name##_type, _reuse_data_type>; \
1196  \
1197  \
1198 private: \
1199  _parameters_name##_type _parameters_name##_; \
1200  \
1201 public: \
1202  static_assert(true, \
1203  "This assert is used to counter the false positive extra " \
1204  "semi-colon warnings")
1205 
1206 
1207 } // namespace gko
1208 
1209 
1210 #endif // GKO_PUBLIC_CORE_BASE_LIN_OP_HPP_
gko::device_matrix_data::copy_to_host
host_type copy_to_host() const
Copies the device_matrix_data entries to the host to return a regular matrix_data object with the sam...
gko::read
std::unique_ptr< MatrixType > read(StreamType &&is, MatrixArgs &&... args)
Reads a matrix stored in matrix market format from an input stream.
Definition: mtx_io.hpp:160
gko::ScaledIdentityAddable::add_scaled_identity
void add_scaled_identity(ptr_param< const LinOp > const a, ptr_param< const LinOp > const b)
Scales this and adds another scalar times the identity to it.
Definition: lin_op.hpp:906
gko::LinOp
Definition: lin_op.hpp:117
gko::EnableDefaultReusableLinOpFactory
EnableDefaultLinOpFactory with LinOpFactory::generate_reuse() support, usually used through GKO_ENABL...
Definition: lin_op.hpp:968
gko::Preconditionable
A LinOp implementing this interface can be preconditioned.
Definition: lin_op.hpp:758
gko::DiagonalExtractable
The diagonal of a LinOp implementing this interface can be extracted.
Definition: lin_op.hpp:818
gko::AbstractFactory
The AbstractFactory is a generic interface template that enables easy implementation of the abstract ...
Definition: abstract_factory.hpp:77
gko::DiagonalLinOpExtractable
The diagonal of a LinOp can be extracted.
Definition: lin_op.hpp:797
gko::PolymorphicObject
A PolymorphicObject is the abstract base for all "heavy" objects in Ginkgo that behave polymorphicall...
Definition: polymorphic_object.hpp:46
gko::LinOp::LinOp
LinOp(LinOp &&other)
Move-constructs a LinOp.
Definition: lin_op.hpp:205
gko::AbstractFactory::generate
std::unique_ptr< abstract_product_type > generate(Args &&... args) const
Creates a new product from the given components.
Definition: abstract_factory.hpp:97
gko::Permutable::permute
virtual std::unique_ptr< LinOp > permute(const array< IndexType > *permutation_indices) const
Returns a LinOp representing the symmetric row and column permutation of the Permutable object.
Definition: lin_op.hpp:561
gko::device_matrix_data::get_executor
std::shared_ptr< const Executor > get_executor() const
Returns the executor used to store the device_matrix_data entries.
Definition: device_matrix_data.hpp:151
gko::Transposable
Linear operators which support transposition should implement the Transposable interface.
Definition: lin_op.hpp:492
gko::device_matrix_data::create_from_host
static device_matrix_data create_from_host(std::shared_ptr< const Executor > exec, const host_type &data)
Creates a device_matrix_data object from the given host data on the given executor.
gko::AbsoluteComputable
The AbsoluteComputable is an interface that allows to get the component wise absolute of a LinOp.
Definition: lin_op.hpp:841
gko::EnableDefaultLinOpFactory
EnableDefaultFactory< ConcreteFactory, ConcreteLinOp, ParametersType, PolymorphicBase > EnableDefaultLinOpFactory
This is an alias for the EnableDefaultFactory mixin, which correctly sets the template parameters to ...
Definition: lin_op.hpp:942
gko::ptr_param::get
T * get() const
Definition: utils_helper.hpp:77
gko::AbsoluteComputable::compute_absolute_linop
virtual std::unique_ptr< LinOp > compute_absolute_linop() const =0
Gets the absolute LinOp.
gko::EnableDefaultFactory
This mixin provides a default implementation of a concrete factory.
Definition: abstract_factory.hpp:154
gko::clone
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition: utils_helper.hpp:425
gko::LinOp::apply
void apply(ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Applies a linear operator to a vector (or a sequence of vectors).
Definition: lin_op.hpp:127
gko::Permutable
Linear operators which support permutation should implement the Permutable interface.
Definition: lin_op.hpp:543
gko::LinOp::operator=
LinOp & operator=(LinOp &&other)
Move-assigns a LinOp.
Definition: lin_op.hpp:188
gko::Preconditionable::get_preconditioner
virtual std::shared_ptr< const LinOp > get_preconditioner() const
Returns the preconditioner operator used by the Preconditionable.
Definition: lin_op.hpp:767
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:19
gko::ReadableFromMatrixData::read
virtual void read(const device_matrix_data< ValueType, IndexType > &data)
Reads a matrix from a device_matrix_data structure.
Definition: lin_op.hpp:693
gko::array< IndexType >
gko::ReadableFromMatrixData::read
void read(const matrix_assembly_data< ValueType, IndexType > &data)
Reads a matrix from a matrix_assembly_data structure.
Definition: lin_op.hpp:683
gko::dim< 2 >
gko::matrix_data
This structure is used as an intermediate data type to store a sparse matrix.
Definition: matrix_data.hpp:126
gko::LinOp::apply_uses_initial_guess
virtual bool apply_uses_initial_guess() const
Returns true if the linear operator uses the data given in x as an initial guess.
Definition: lin_op.hpp:178
gko::Permutable::inverse_permute
virtual std::unique_ptr< LinOp > inverse_permute(const array< IndexType > *permutation_indices) const
Returns a LinOp representing the symmetric inverse row and column permutation of the Permutable objec...
Definition: lin_op.hpp:582
gko::matrix::Diagonal
This class is a utility which efficiently implements the diagonal matrix (a linear operator which sca...
Definition: lin_op.hpp:31
gko::EnableDefaultReusableLinOpFactory::generate_reuse
std::unique_ptr< ConcreteLinOp > generate_reuse(std::shared_ptr< const LinOp > input, LinOpFactory::ReuseData &reuse_data) const
LinOpFactory::generate_reuse(), returning the concrete LinOp type.
Definition: lin_op.hpp:977
gko::matrix_assembly_data::get_ordered_data
matrix_data< ValueType, IndexType > get_ordered_data() const
Definition: matrix_assembly_data.hpp:142
gko::Preconditionable::set_preconditioner
virtual void set_preconditioner(std::shared_ptr< const LinOp > new_precond)
Sets the preconditioner operator used by the Preconditionable.
Definition: lin_op.hpp:778
gko::ptr_param
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:43
gko::LinOp::apply
void apply(ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) const
Performs the operation x = alpha * op(b) + beta * x.
Definition: lin_op.hpp:148
gko::LinOpFactory::generate_reuse
std::unique_ptr< LinOp > generate_reuse(std::shared_ptr< const LinOp > input, ReuseData &reuse_data) const
Generates a LinOp like generate(), reusing what earlier calls recorded in reuse_data.
gko::AbsoluteComputable::compute_absolute_inplace
virtual void compute_absolute_inplace()=0
Compute absolute inplace on each element.
gko::ReadableFromMatrixData::read
virtual void read(device_matrix_data< ValueType, IndexType > &&data)
Reads a matrix from a device_matrix_data structure.
Definition: lin_op.hpp:704
gko::ReadableFromMatrixData
A LinOp implementing this interface can read its data from a matrix_data structure.
Definition: lin_op.hpp:664
gko::WritableToMatrixData
A LinOp implementing this interface can write its data to a matrix_data structure.
Definition: lin_op.hpp:719
gko::LinOp::operator=
LinOp & operator=(const LinOp &)=default
Copy-assigns a LinOp.
gko::write
void write(StreamType &&os, MatrixPtrType &&matrix, layout_type layout=detail::mtx_io_traits< std::remove_cv_t< detail::pointee< MatrixPtrType >>>::default_layout)
Writes a matrix into an output stream in matrix market format.
Definition: mtx_io.hpp:299
gko::transpose
batch_dim< 2, DimensionType > transpose(const batch_dim< 2, DimensionType > &input)
Returns a batch_dim object with its dimensions swapped for batched operators.
Definition: batch_dim.hpp:118
gko::ScaledIdentityAddable
Adds the operation M <- a I + b M for matrix M, identity operator I and scalars a and b,...
Definition: lin_op.hpp:895
gko::matrix_assembly_data
This structure is used as an intermediate type to assemble a sparse matrix.
Definition: matrix_assembly_data.hpp:59
gko::LinOpFactory::ReuseData
Opaque base for the data a factory records in generate_reuse() to speed up later generations.
Definition: lin_op.hpp:371
gko::WritableToMatrixData::write
virtual void write(device_matrix_data< ValueType, IndexType > &data) const
Writes a matrix to a device_matrix_data structure.
Definition: lin_op.hpp:742
gko::EnableAbsoluteComputation::compute_absolute
virtual std::unique_ptr< absolute_type > compute_absolute() const =0
Gets the AbsoluteLinOp.
gko::make_temporary_clone
detail::temporary_clone< detail::pointee< Ptr > > make_temporary_clone(std::shared_ptr< const Executor > exec, Ptr &&ptr)
Creates a temporary_clone.
Definition: temporary_clone.hpp:208
gko::EnableAbsoluteComputation
The EnableAbsoluteComputation mixin provides the default implementations of compute_absolute_linop an...
Definition: lin_op.hpp:871
gko::LinOpFactory
A LinOpFactory represents a higher order mapping which transforms one linear operator into another.
Definition: lin_op.hpp:343
gko::EnableAbsoluteComputation::compute_absolute_linop
std::unique_ptr< LinOp > compute_absolute_linop() const override
Gets the absolute LinOp.
Definition: lin_op.hpp:877
gko::PolymorphicObject::get_executor
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition: polymorphic_object.hpp:69
gko::LinOp::get_size
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition: lin_op.hpp:169
gko::device_matrix_data
This type is a device-side equivalent to matrix_data.
Definition: device_matrix_data.hpp:36
gko::LinOp::LinOp
LinOp(const LinOp &)=default
Copy-constructs a LinOp.