Ginkgo: ginkgo/core/solver/batch_cg.hpp Source File

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
batch_cg.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_SOLVER_BATCH_CG_HPP_
6#define GKO_PUBLIC_CORE_SOLVER_BATCH_CG_HPP_
7
8
9#include <vector>
10
11#include <ginkgo/core/base/batch_lin_op.hpp>
12#include <ginkgo/core/base/batch_multi_vector.hpp>
13#include <ginkgo/core/base/exception_helpers.hpp>
14#include <ginkgo/core/base/lin_op.hpp>
15#include <ginkgo/core/base/types.hpp>
16#include <ginkgo/core/solver/batch_solver_base.hpp>
17#include <ginkgo/core/stop/batch_stop_enum.hpp>
18
19
20namespace gko {
21namespace batch {
22namespace solver {
23
24
49template <typename ValueType = default_precision>
50 class Cg final : public EnableBatchSolver<Cg<ValueType>, ValueType> {
51 friend class EnableBatchLinOp<Cg>;
52 friend class EnablePolymorphicObject<Cg, BatchLinOp>;
53 GKO_ASSERT_SUPPORTED_VALUE_TYPE;
54
55public:
56 using value_type = ValueType;
57 using real_type = gko::remove_complex<ValueType>;
58
59 class Factory;
60
61 struct parameters_type
62 : enable_preconditioned_iterative_solver_factory_parameters<
63 parameters_type, Factory> {};
64 GKO_ENABLE_BATCH_LIN_OP_FACTORY(Cg, parameters, Factory);
65 GKO_ENABLE_BUILD_METHOD(Factory);
66
67private:
68 explicit Cg(std::shared_ptr<const Executor> exec);
69
70 explicit Cg(const Factory* factory,
71 std::shared_ptr<const BatchLinOp> system_matrix);
72
73 void solver_apply(
74 const MultiVector<ValueType>* b, MultiVector<ValueType>* x,
75 log::detail::log_data<real_type>* log_data) const override;
76};
77
78
79} // namespace solver
80} // namespace batch
81} // namespace gko
82
83
84#endif // GKO_PUBLIC_CORE_SOLVER_BATCH_CG_HPP_
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
gko::batch::BatchLinOp
Definition batch_lin_op.hpp:59
gko::batch::EnableBatchLinOp
The EnableBatchLinOp mixin can be used to provide sensible default implementations of the majority of...
Definition batch_lin_op.hpp:252
gko::batch::MultiVector
MultiVector stores multiple vectors in a batched fashion and is useful for batched operations.
Definition batch_multi_vector.hpp:61
gko::batch::solver::Cg::Factory
Definition batch_cg.hpp:64
GKO_ENABLE_BATCH_LIN_OP_FACTORY
#define GKO_ENABLE_BATCH_LIN_OP_FACTORY(_batch_lin_op, _parameters_name, _factory_name)
This macro will generate a default implementation of a BatchLinOpFactory for the BatchLinOp subclass ...
Definition batch_lin_op.hpp:358
GKO_ENABLE_BUILD_METHOD
#define GKO_ENABLE_BUILD_METHOD(_factory_name)
Defines a build method for the factory, simplifying its construction by removing the repetitive typin...
Definition abstract_factory.hpp:394
gko
The Ginkgo namespace.
Definition abstract_factory.hpp:20
gko::remove_complex
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition math.hpp:264
gko::batch::solver::Cg::parameters_type
Definition batch_cg.hpp:63
gko::batch::solver::enable_preconditioned_iterative_solver_factory_parameters
Definition batch_solver_base.hpp:154