Ginkgo Generated from branch based on master. Ginkgo version 1.7.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
batch_bicgstab.hpp
1/*******************************<GINKGO LICENSE>******************************
2Copyright (c) 2017-2023, the Ginkgo authors
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
8
91. Redistributions of source code must retain the above copyright
10notice, this list of conditions and the following disclaimer.
11
122. Redistributions in binary form must reproduce the above copyright
13notice, this list of conditions and the following disclaimer in the
14documentation and/or other materials provided with the distribution.
15
163. Neither the name of the copyright holder nor the names of its
17contributors may be used to endorse or promote products derived from
18this software without specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31******************************<GINKGO LICENSE>*******************************/
32
33#ifndef GKO_PUBLIC_CORE_SOLVER_BATCH_BICGSTAB_HPP_
34#define GKO_PUBLIC_CORE_SOLVER_BATCH_BICGSTAB_HPP_
35
36
37#include <vector>
38
39
40#include <ginkgo/core/base/batch_lin_op.hpp>
41#include <ginkgo/core/base/batch_multi_vector.hpp>
42#include <ginkgo/core/base/exception_helpers.hpp>
43#include <ginkgo/core/base/lin_op.hpp>
44#include <ginkgo/core/base/types.hpp>
45#include <ginkgo/core/solver/batch_solver_base.hpp>
46#include <ginkgo/core/stop/batch_stop_enum.hpp>
47
48
49namespace gko {
50namespace batch {
51namespace solver {
52
53
78template <typename ValueType = default_precision>
80 : public EnableBatchSolver<Bicgstab<ValueType>, ValueType> {
81 friend class EnableBatchLinOp<Bicgstab>;
83
84public:
85 using value_type = ValueType;
86 using real_type = gko::remove_complex<ValueType>;
87
88 class Factory;
89
95
96private:
97 explicit Bicgstab(std::shared_ptr<const Executor> exec)
98 : EnableBatchSolver<Bicgstab, ValueType>(std::move(exec))
99 {}
100
101 explicit Bicgstab(const Factory* factory,
102 std::shared_ptr<const BatchLinOp> system_matrix)
103 : EnableBatchSolver<Bicgstab, ValueType>(factory->get_executor(),
104 std::move(system_matrix),
105 factory->get_parameters()),
106 parameters_{factory->get_parameters()}
107 {}
108
109 void solver_apply(
111 log::detail::log_data<real_type>* log_data) const override;
112};
113
114
115} // namespace solver
116} // namespace batch
117} // namespace gko
118
119
120#endif // GKO_PUBLIC_CORE_SOLVER_BATCH_BICGSTAB_HPP_
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition polymorphic_object.hpp:263
Definition batch_lin_op.hpp:88
The EnableBatchLinOp mixin can be used to provide sensible default implementations of the majority of...
Definition batch_lin_op.hpp:281
MultiVector stores multiple vectors in a batched fashion and is useful for batched operations.
Definition batch_multi_vector.hpp:85
Definition batch_bicgstab.hpp:93
BiCGSTAB or the Bi-Conjugate Gradient-Stabilized is a Krylov subspace solver.
Definition batch_bicgstab.hpp:80
This mixin provides apply and common iterative solver functionality to all the batched solvers.
Definition batch_solver_base.hpp:234
#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:387
#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:422
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
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:354
Definition batch_bicgstab.hpp:92