Ginkgo  Generated from pipelines/1589998975 branch based on develop. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
solver_base.hpp
1 // SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_SOLVER_SOLVER_BASE_HPP_
6 #define GKO_PUBLIC_CORE_SOLVER_SOLVER_BASE_HPP_
7 
8 
9 #include <memory>
10 #include <type_traits>
11 #include <utility>
12 
13 #include <ginkgo/core/base/lin_op.hpp>
14 #include <ginkgo/core/base/math.hpp>
15 #include <ginkgo/core/log/logger.hpp>
16 #include <ginkgo/core/matrix/dense.hpp>
17 #include <ginkgo/core/matrix/identity.hpp>
18 #include <ginkgo/core/solver/workspace.hpp>
19 #include <ginkgo/core/stop/combined.hpp>
20 #include <ginkgo/core/stop/criterion.hpp>
21 
22 
23 GKO_BEGIN_DISABLE_DEPRECATION_WARNINGS
24 
25 
26 namespace gko {
27 namespace solver {
28 
29 
33 enum class initial_guess_mode {
37  zero,
41  rhs,
45  provided
46 };
47 
48 
49 namespace multigrid {
50 namespace detail {
51 
52 
53 class MultigridState;
54 
55 
56 } // namespace detail
57 } // namespace multigrid
58 
59 
66 protected:
67  friend class multigrid::detail::MultigridState;
68 
82  virtual void apply_with_initial_guess(const LinOp* b, LinOp* x,
83  initial_guess_mode guess) const = 0;
84 
85  void apply_with_initial_guess(ptr_param<const LinOp> b, ptr_param<LinOp> x,
86  initial_guess_mode guess) const
87  {
88  apply_with_initial_guess(b.get(), x.get(), guess);
89  }
90 
103  virtual void apply_with_initial_guess(const LinOp* alpha, const LinOp* b,
104  const LinOp* beta, LinOp* x,
105  initial_guess_mode guess) const = 0;
106 
107 
108  void apply_with_initial_guess(ptr_param<const LinOp> alpha,
112  initial_guess_mode guess) const
113  {
114  apply_with_initial_guess(alpha.get(), b.get(), beta.get(), x.get(),
115  guess);
116  }
117 
123  initial_guess_mode get_default_initial_guess() const { return guess_; }
124 
131  explicit ApplyWithInitialGuess(
133  : guess_(guess)
134  {}
135 
141  void set_default_initial_guess(initial_guess_mode guess) { guess_ = guess; }
142 
143 private:
144  initial_guess_mode guess_;
145 };
146 
147 
160 template <typename DerivedType>
162 protected:
163  friend class multigrid::detail::MultigridState;
164 
167  : ApplyWithInitialGuess(guess)
168  {}
169 
174  void apply_with_initial_guess(const LinOp* b, LinOp* x,
175  initial_guess_mode guess) const override
176  {
177  self()->template log<log::Logger::linop_apply_started>(self(), b, x);
178  auto exec = self()->get_executor();
179  GKO_ASSERT_CONFORMANT(self(), b);
180  GKO_ASSERT_EQUAL_ROWS(self(), x);
181  GKO_ASSERT_EQUAL_COLS(b, x);
182  this->apply_with_initial_guess_impl(make_temporary_clone(exec, b).get(),
183  make_temporary_clone(exec, x).get(),
184  guess);
185  self()->template log<log::Logger::linop_apply_completed>(self(), b, x);
186  }
187 
192  void apply_with_initial_guess(const LinOp* alpha, const LinOp* b,
193  const LinOp* beta, LinOp* x,
194  initial_guess_mode guess) const override
195  {
196  self()->template log<log::Logger::linop_advanced_apply_started>(
197  self(), alpha, b, beta, x);
198  auto exec = self()->get_executor();
199  GKO_ASSERT_CONFORMANT(self(), b);
200  GKO_ASSERT_EQUAL_ROWS(self(), x);
201  GKO_ASSERT_EQUAL_COLS(b, x);
202  GKO_ASSERT_EQUAL_DIMENSIONS(alpha, dim<2>(1, 1));
203  GKO_ASSERT_EQUAL_DIMENSIONS(beta, dim<2>(1, 1));
204  this->apply_with_initial_guess_impl(
205  make_temporary_clone(exec, alpha).get(),
206  make_temporary_clone(exec, b).get(),
207  make_temporary_clone(exec, beta).get(),
208  make_temporary_clone(exec, x).get(), guess);
209  self()->template log<log::Logger::linop_advanced_apply_completed>(
210  self(), alpha, b, beta, x);
211  }
212 
213  // TODO: should we provide the default implementation?
218  virtual void apply_with_initial_guess_impl(
219  const LinOp* b, LinOp* x, initial_guess_mode guess) const = 0;
220 
225  virtual void apply_with_initial_guess_impl(
226  const LinOp* alpha, const LinOp* b, const LinOp* beta, LinOp* x,
227  initial_guess_mode guess) const = 0;
228 
229  GKO_ENABLE_SELF(DerivedType);
230 };
231 
232 
237 template <typename Solver>
239  // number of vectors used by this workspace
240  static int num_vectors(const Solver&) { return 0; }
241  // number of arrays used by this workspace
242  static int num_arrays(const Solver&) { return 0; }
243  // array containing the num_vectors names for the workspace vectors
244  static std::vector<std::string> op_names(const Solver&) { return {}; }
245  // array containing the num_arrays names for the workspace vectors
246  static std::vector<std::string> array_names(const Solver&) { return {}; }
247  // array containing all scalar vectors (independent of problem size)
248  static std::vector<int> scalars(const Solver&) { return {}; }
249  // array containing all vectors (dependent on problem size)
250  static std::vector<int> vectors(const Solver&) { return {}; }
251 };
252 
253 
269 template <typename DerivedType>
271 public:
278  void set_preconditioner(std::shared_ptr<const LinOp> new_precond) override
279  {
280  auto exec = self()->get_executor();
281  if (new_precond) {
282  GKO_ASSERT_EQUAL_DIMENSIONS(self(), new_precond);
283  GKO_ASSERT_IS_SQUARE_MATRIX(new_precond);
284  if (new_precond->get_executor() != exec) {
285  new_precond = gko::clone(exec, new_precond);
286  }
287  }
289  }
290 
296  {
297  if (&other != this) {
299  }
300  return *this;
301  }
302 
309  {
310  if (&other != this) {
311  set_preconditioner(other.get_preconditioner());
312  other.set_preconditioner(nullptr);
313  }
314  return *this;
315  }
316 
317  EnablePreconditionable() = default;
318 
319  EnablePreconditionable(std::shared_ptr<const LinOp> preconditioner)
320  {
321  set_preconditioner(std::move(preconditioner));
322  }
323 
328  {
329  *this = other;
330  }
331 
337  {
338  *this = std::move(other);
339  }
340 
341 private:
342  DerivedType* self() { return static_cast<DerivedType*>(this); }
343 
344  const DerivedType* self() const
345  {
346  return static_cast<const DerivedType*>(this);
347  }
348 };
349 
350 
351 namespace detail {
352 
353 
362 class SolverBaseLinOp {
363 public:
364  SolverBaseLinOp(std::shared_ptr<const Executor> exec)
365  : workspace_{std::move(exec)}
366  {}
367 
368  virtual ~SolverBaseLinOp() = default;
369 
375  std::shared_ptr<const LinOp> get_system_matrix() const
376  {
377  return system_matrix_;
378  }
379 
380  const LinOp* get_workspace_op(int vector_id) const
381  {
382  return workspace_.get_op(vector_id);
383  }
384 
385  virtual int get_num_workspace_ops() const { return 0; }
386 
387  virtual std::vector<std::string> get_workspace_op_names() const
388  {
389  return {};
390  }
391 
396  virtual std::vector<int> get_workspace_scalars() const { return {}; }
397 
402  virtual std::vector<int> get_workspace_vectors() const { return {}; }
403 
404 protected:
405  void set_system_matrix_base(std::shared_ptr<const LinOp> system_matrix)
406  {
407  system_matrix_ = std::move(system_matrix);
408  }
409 
410  void set_workspace_size(int num_operators, int num_arrays) const
411  {
412  workspace_.set_size(num_operators, num_arrays);
413  }
414 
415  template <typename LinOpType>
416  LinOpType* create_workspace_op(int vector_id, gko::dim<2> size) const
417  {
418  return workspace_.template create_or_get_op<LinOpType>(
419  vector_id,
420  [&] {
421  return LinOpType::create(this->workspace_.get_executor(), size);
422  },
423  typeid(LinOpType), size, size[1]);
424  }
425 
426  template <typename LinOpType>
427  LinOpType* create_workspace_op_with_config_of(int vector_id,
428  const LinOpType* vec) const
429  {
430  return workspace_.template create_or_get_op<LinOpType>(
431  vector_id, [&] { return LinOpType::create_with_config_of(vec); },
432  typeid(*vec), vec->get_size(), vec->get_stride());
433  }
434 
435  template <typename LinOpType>
436  LinOpType* create_workspace_op_with_type_of(int vector_id,
437  const LinOpType* vec,
438  dim<2> size) const
439  {
440  return workspace_.template create_or_get_op<LinOpType>(
441  vector_id,
442  [&] {
443  return LinOpType::create_with_type_of(
444  vec, workspace_.get_executor(), size, size[1]);
445  },
446  typeid(*vec), size, size[1]);
447  }
448 
449  template <typename LinOpType>
450  LinOpType* create_workspace_op_with_type_of(int vector_id,
451  const LinOpType* vec,
452  dim<2> global_size,
453  dim<2> local_size) const
454  {
455  return workspace_.template create_or_get_op<LinOpType>(
456  vector_id,
457  [&] {
458  return LinOpType::create_with_type_of(
459  vec, workspace_.get_executor(), global_size, local_size,
460  local_size[1]);
461  },
462  typeid(*vec), global_size, local_size[1]);
463  }
464 
465  template <typename ValueType>
466  matrix::Dense<ValueType>* create_workspace_scalar(int vector_id,
467  size_type size) const
468  {
469  return workspace_.template create_or_get_op<matrix::Dense<ValueType>>(
470  vector_id,
471  [&] {
473  workspace_.get_executor(), dim<2>{1, size});
474  },
475  typeid(matrix::Dense<ValueType>), gko::dim<2>{1, size}, size);
476  }
477 
478  template <typename ValueType>
479  array<ValueType>& create_workspace_array(int array_id, size_type size) const
480  {
481  return workspace_.template create_or_get_array<ValueType>(array_id,
482  size);
483  }
484 
485  template <typename ValueType>
486  array<ValueType>& create_workspace_array(int array_id) const
487  {
488  return workspace_.template init_or_get_array<ValueType>(array_id);
489  }
490 
491 private:
492  mutable detail::workspace workspace_;
493 
494  std::shared_ptr<const LinOp> system_matrix_;
495 };
496 
497 
498 } // namespace detail
499 
500 
501 template <typename MatrixType>
502 class
503  // clang-format off
504  GKO_DEPRECATED("This class will be replaced by the template-less detail::SolverBaseLinOp in a future release") SolverBase
505  // clang-format on
506  : public detail::SolverBaseLinOp {
507 public:
508  using detail::SolverBaseLinOp::SolverBaseLinOp;
509 
517  std::shared_ptr<const MatrixType> get_system_matrix() const
518  {
519  return std::dynamic_pointer_cast<const MatrixType>(
520  SolverBaseLinOp::get_system_matrix());
521  }
522 
523 protected:
524  void set_system_matrix_base(std::shared_ptr<const MatrixType> system_matrix)
525  {
526  SolverBaseLinOp::set_system_matrix_base(std::move(system_matrix));
527  }
528 };
529 
530 
540 template <typename DerivedType, typename MatrixType = LinOp>
541 class EnableSolverBase : public SolverBase<MatrixType> {
542 public:
548  {
549  if (&other != this) {
550  set_system_matrix(other.get_system_matrix());
551  }
552  return *this;
553  }
554 
560  {
561  if (&other != this) {
562  set_system_matrix(other.get_system_matrix());
563  other.set_system_matrix(nullptr);
564  }
565  return *this;
566  }
567 
568  EnableSolverBase() : SolverBase<MatrixType>{self()->get_executor()} {}
569 
570  EnableSolverBase(std::shared_ptr<const MatrixType> system_matrix)
571  : SolverBase<MatrixType>{self()->get_executor()}
572  {
573  set_system_matrix(std::move(system_matrix));
574  }
575 
580  : SolverBase<MatrixType>{other.self()->get_executor()}
581  {
582  *this = other;
583  }
584 
590  : SolverBase<MatrixType>{other.self()->get_executor()}
591  {
592  *this = std::move(other);
593  }
594 
595  int get_num_workspace_ops() const override
596  {
597  using traits = workspace_traits<DerivedType>;
598  return traits::num_vectors(*self());
599  }
600 
601  std::vector<std::string> get_workspace_op_names() const override
602  {
603  using traits = workspace_traits<DerivedType>;
604  return traits::op_names(*self());
605  }
606 
611  std::vector<int> get_workspace_scalars() const override
612  {
613  using traits = workspace_traits<DerivedType>;
614  return traits::scalars(*self());
615  }
616 
621  std::vector<int> get_workspace_vectors() const override
622  {
623  using traits = workspace_traits<DerivedType>;
624  return traits::vectors(*self());
625  }
626 
627 protected:
628  void set_system_matrix(std::shared_ptr<const MatrixType> new_system_matrix)
629  {
630  auto exec = self()->get_executor();
631  if (new_system_matrix) {
632  GKO_ASSERT_EQUAL_DIMENSIONS(self(), new_system_matrix);
633  GKO_ASSERT_IS_SQUARE_MATRIX(new_system_matrix);
634  if (new_system_matrix->get_executor() != exec) {
635  new_system_matrix = gko::clone(exec, new_system_matrix);
636  }
637  }
638  this->set_system_matrix_base(new_system_matrix);
639  }
640 
641  void setup_workspace() const
642  {
643  using traits = workspace_traits<DerivedType>;
644  this->set_workspace_size(traits::num_vectors(*self()),
645  traits::num_arrays(*self()));
646  }
647 
648 private:
649  DerivedType* self() { return static_cast<DerivedType*>(this); }
650 
651  const DerivedType* self() const
652  {
653  return static_cast<const DerivedType*>(this);
654  }
655 };
656 
657 
665 public:
671  std::shared_ptr<const stop::CriterionFactory> get_stop_criterion_factory()
672  const
673  {
674  return stop_factory_;
675  }
676 
683  std::shared_ptr<const stop::CriterionFactory> new_stop_factory)
684  {
685  stop_factory_ = new_stop_factory;
686  }
687 
688 private:
689  std::shared_ptr<const stop::CriterionFactory> stop_factory_;
690 };
691 
692 
702 template <typename DerivedType>
704 public:
710  {
711  if (&other != this) {
713  }
714  return *this;
715  }
716 
723  {
724  if (&other != this) {
725  set_stop_criterion_factory(other.get_stop_criterion_factory());
726  other.set_stop_criterion_factory(nullptr);
727  }
728  return *this;
729  }
730 
731  EnableIterativeBase() = default;
732 
734  std::shared_ptr<const stop::CriterionFactory> stop_factory)
735  {
736  set_stop_criterion_factory(std::move(stop_factory));
737  }
738 
742  EnableIterativeBase(const EnableIterativeBase& other) { *this = other; }
743 
749  {
750  *this = std::move(other);
751  }
752 
754  std::shared_ptr<const stop::CriterionFactory> new_stop_factory) override
755  {
756  auto exec = self()->get_executor();
757  if (new_stop_factory && new_stop_factory->get_executor() != exec) {
758  new_stop_factory = gko::clone(exec, new_stop_factory);
759  }
761  }
762 
763 private:
764  DerivedType* self() { return static_cast<DerivedType*>(this); }
765 
766  const DerivedType* self() const
767  {
768  return static_cast<const DerivedType*>(this);
769  }
770 };
771 
772 
783 template <typename ValueType, typename DerivedType>
785  : public EnableSolverBase<DerivedType>,
786  public EnableIterativeBase<DerivedType>,
787  public EnablePreconditionable<DerivedType> {
788 public:
790 
792  std::shared_ptr<const LinOp> system_matrix,
793  std::shared_ptr<const stop::CriterionFactory> stop_factory,
794  std::shared_ptr<const LinOp> preconditioner)
795  : EnableSolverBase<DerivedType>(std::move(system_matrix)),
796  EnableIterativeBase<DerivedType>{std::move(stop_factory)},
797  EnablePreconditionable<DerivedType>{std::move(preconditioner)}
798  {}
799 
800  template <typename FactoryParameters>
802  std::shared_ptr<const LinOp> system_matrix,
803  const FactoryParameters& params)
805  system_matrix, stop::combine(params.criteria),
806  generate_preconditioner(system_matrix, params)}
807  {}
808 
809 private:
810  template <typename FactoryParameters>
811  static std::shared_ptr<const LinOp> generate_preconditioner(
812  std::shared_ptr<const LinOp> system_matrix,
813  const FactoryParameters& params)
814  {
815  if (params.generated_preconditioner) {
816  return params.generated_preconditioner;
817  } else if (params.preconditioner) {
818  return params.preconditioner->generate(system_matrix);
819  } else {
821  system_matrix->get_executor(), system_matrix->get_size());
822  }
823  }
824 };
825 
826 
827 template <typename Parameters, typename Factory>
829  : enable_parameters_type<Parameters, Factory> {
833  std::vector<std::shared_ptr<const stop::CriterionFactory>>
834  GKO_DEFERRED_FACTORY_VECTOR_PARAMETER(criteria);
835 };
836 
837 
838 template <typename Parameters, typename Factory>
840  : enable_iterative_solver_factory_parameters<Parameters, Factory> {
845  std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
847 
852  std::shared_ptr<const LinOp> GKO_FACTORY_PARAMETER_SCALAR(
854 };
855 
856 
857 } // namespace solver
858 } // namespace gko
859 
860 
861 GKO_END_DISABLE_DEPRECATION_WARNINGS
862 
863 
864 #endif // GKO_PUBLIC_CORE_SOLVER_SOLVER_BASE_HPP_
gko::solver::EnableIterativeBase::EnableIterativeBase
EnableIterativeBase(const EnableIterativeBase &other)
Creates a shallow copy of the provided stopping criterion.
Definition: solver_base.hpp:742
gko::solver::EnableSolverBase::EnableSolverBase
EnableSolverBase(const EnableSolverBase &other)
Creates a shallow copy of the provided system matrix.
Definition: solver_base.hpp:579
gko::solver::EnableApplyWithInitialGuess
EnableApplyWithInitialGuess providing default operation for ApplyWithInitialGuess with correct valida...
Definition: solver_base.hpp:161
gko::log::profile_event_category::solver
Solver events.
gko::solver::EnableIterativeBase
A LinOp deriving from this CRTP class stores a stopping criterion factory and allows applying with a ...
Definition: solver_base.hpp:703
gko::solver::EnableSolverBase::operator=
EnableSolverBase & operator=(EnableSolverBase &&other)
Moves the provided system matrix, clones it onto this executor if executors don't match.
Definition: solver_base.hpp:559
gko::LinOp
Definition: lin_op.hpp:117
gko::solver::EnableSolverBase::get_workspace_vectors
std::vector< int > get_workspace_vectors() const override
Returns the IDs of all vectors (workspace vectors with system dimension-dependent size,...
Definition: solver_base.hpp:621
gko::Preconditionable
A LinOp implementing this interface can be preconditioned.
Definition: lin_op.hpp:682
gko::solver::enable_iterative_solver_factory_parameters
Definition: solver_base.hpp:828
gko::matrix::Dense::create
static std::unique_ptr< Dense > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size={}, size_type stride=0)
Creates an uninitialized Dense matrix of the specified size.
gko::solver::EnablePreconditionable::operator=
EnablePreconditionable & operator=(const EnablePreconditionable &other)
Creates a shallow copy of the provided preconditioner, clones it onto this executor if executors don'...
Definition: solver_base.hpp:295
gko::size_type
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:89
gko::ptr_param::get
T * get() const
Definition: utils_helper.hpp:75
gko::solver::enable_preconditioned_iterative_solver_factory_parameters
Definition: solver_base.hpp:839
gko::solver::initial_guess_mode::zero
the input is zero
gko::solver::EnablePreconditionable::EnablePreconditionable
EnablePreconditionable(const EnablePreconditionable &other)
Creates a shallow copy of the provided preconditioner.
Definition: solver_base.hpp:327
GKO_FACTORY_PARAMETER_SCALAR
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition: abstract_factory.hpp:445
gko::solver::enable_iterative_solver_factory_parameters::criteria
std::vector< std::shared_ptr< const stop::CriterionFactory > > criteria
Stopping criteria to be used by the solver.
Definition: solver_base.hpp:834
gko::solver::EnableSolverBase::get_workspace_scalars
std::vector< int > get_workspace_scalars() const override
Returns the IDs of all scalars (workspace vectors with system dimension-independent size,...
Definition: solver_base.hpp:611
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:173
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:691
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
gko::solver::EnableIterativeBase::set_stop_criterion_factory
void set_stop_criterion_factory(std::shared_ptr< const stop::CriterionFactory > new_stop_factory) override
Sets the stopping criterion of the solver.
Definition: solver_base.hpp:753
gko::solver::EnablePreconditionable
Mixin providing default operation for Preconditionable with correct value semantics.
Definition: solver_base.hpp:270
gko::solver::EnableSolverBase::operator=
EnableSolverBase & operator=(const EnableSolverBase &other)
Creates a shallow copy of the provided system matrix, clones it onto this executor if executors don't...
Definition: solver_base.hpp:547
gko::dim< 2 >
gko::solver::EnableIterativeBase::operator=
EnableIterativeBase & operator=(EnableIterativeBase &&other)
Moves the provided stopping criterion, clones it onto this executor if executors don't match.
Definition: solver_base.hpp:722
gko::solver::EnablePreconditionable::operator=
EnablePreconditionable & operator=(EnablePreconditionable &&other)
Moves the provided preconditioner, clones it onto this executor if executors don't match.
Definition: solver_base.hpp:308
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:702
gko::ptr_param
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:41
gko::stop::combine
std::shared_ptr< const CriterionFactory > combine(FactoryContainer &&factories)
Combines multiple criterion factories into a single combined criterion factory.
Definition: combined.hpp:109
gko::solver::enable_preconditioned_iterative_solver_factory_parameters::generated_preconditioner
std::shared_ptr< const LinOp > generated_preconditioner
Already generated preconditioner.
Definition: solver_base.hpp:853
gko::solver::SolverBase
Definition: solver_base.hpp:502
gko::solver::EnablePreconditionable::set_preconditioner
void set_preconditioner(std::shared_ptr< const LinOp > new_precond) override
Sets the preconditioner operator used by the Preconditionable.
Definition: solver_base.hpp:278
gko::solver::initial_guess_mode::rhs
the input is right hand side
gko::matrix::Identity::create
static std::unique_ptr< Identity > create(std::shared_ptr< const Executor > exec, dim< 2 > size)
Creates an Identity matrix of the specified size.
gko::solver::EnableSolverBase
A LinOp deriving from this CRTP class stores a system matrix.
Definition: solver_base.hpp:541
gko::solver::IterativeBase::set_stop_criterion_factory
virtual void set_stop_criterion_factory(std::shared_ptr< const stop::CriterionFactory > new_stop_factory)
Sets the stopping criterion of the solver.
Definition: solver_base.hpp:682
gko::solver::IterativeBase
A LinOp implementing this interface stores a stopping criterion factory.
Definition: solver_base.hpp:664
gko::solver::EnableSolverBase::EnableSolverBase
EnableSolverBase(EnableSolverBase &&other)
Moves the provided system matrix.
Definition: solver_base.hpp:589
gko::solver::SolverBase::get_system_matrix
std::shared_ptr< const MatrixType > get_system_matrix() const
Returns the system matrix, with its concrete type, used by the solver.
Definition: solver_base.hpp:517
gko::solver::IterativeBase::get_stop_criterion_factory
std::shared_ptr< const stop::CriterionFactory > get_stop_criterion_factory() const
Gets the stopping criterion factory of the solver.
Definition: solver_base.hpp:671
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::solver::initial_guess_mode
initial_guess_mode
Give a initial guess mode about the input of the apply method.
Definition: solver_base.hpp:33
gko::solver::EnablePreconditionable::EnablePreconditionable
EnablePreconditionable(EnablePreconditionable &&other)
Moves the provided preconditioner.
Definition: solver_base.hpp:336
gko::solver::initial_guess_mode::provided
the input is provided
gko::solver::EnableIterativeBase::EnableIterativeBase
EnableIterativeBase(EnableIterativeBase &&other)
Moves the provided stopping criterion.
Definition: solver_base.hpp:748
gko::solver::workspace_traits
Traits class providing information on the type and location of workspace vectors inside a solver.
Definition: solver_base.hpp:238
gko::enable_parameters_type
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition: abstract_factory.hpp:211
gko::solver::EnableIterativeBase::operator=
EnableIterativeBase & operator=(const EnableIterativeBase &other)
Creates a shallow copy of the provided stopping criterion, clones it onto this executor if executors ...
Definition: solver_base.hpp:709
gko::solver::ApplyWithInitialGuess
ApplyWithInitialGuess provides a way to give the input guess for apply function.
Definition: solver_base.hpp:65
gko::solver::enable_preconditioned_iterative_solver_factory_parameters::preconditioner
std::shared_ptr< const LinOpFactory > preconditioner
The preconditioner to be used by the iterative solver.
Definition: solver_base.hpp:846
gko::solver::EnablePreconditionedIterativeSolver
A LinOp implementing this interface stores a system matrix and stopping criterion factory.
Definition: solver_base.hpp:784