5 #ifndef GKO_PUBLIC_CORE_SOLVER_NULLSPACE_HPP_
6 #define GKO_PUBLIC_CORE_SOLVER_NULLSPACE_HPP_
12 #include <ginkgo/core/base/array.hpp>
13 #include <ginkgo/core/base/dense_cache.hpp>
14 #include <ginkgo/core/base/lin_op.hpp>
15 #include <ginkgo/core/base/math.hpp>
16 #include <ginkgo/core/base/polymorphic_object.hpp>
17 #include <ginkgo/core/base/utils.hpp>
18 #include <ginkgo/core/matrix/dense.hpp>
58 template <
typename ValueType = default_precision>
61 GKO_ASSERT_SUPPORTED_VALUE_TYPE;
67 using value_type = ValueType;
84 static std::unique_ptr<Nullspace>
create(
85 std::shared_ptr<const Executor> exec,
86 std::vector<std::shared_ptr<const LinOp>> basis,
105 std::shared_ptr<const Executor> exec,
dim<2> size = {});
121 std::shared_ptr<const LinOp>
get_basis()
const noexcept;
145 explicit Nullspace(std::shared_ptr<const Executor> exec);
148 std::vector<std::shared_ptr<const LinOp>> basis,
151 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
154 LinOp* x)
const override;
157 template <
typename VectorType>
158 void setup_basis(
const std::vector<std::shared_ptr<const LinOp>>& basis);
160 template <
typename VectorType>
164 template <
typename VectorType>
165 void compute_components(
const VectorType* v,
167 bool has_constant)
const;
171 template <
typename VectorType>
172 void subtract_components(
const VectorType* v, VectorType* result,
174 bool has_constant)
const;
176 template <
typename VectorType>
177 void remove_components(VectorType* v,
179 bool has_constant)
const;
181 bool contains_constant_;
183 std::shared_ptr<const LinOp> basis_;
185 gko::detail::DenseCache<ValueType> coefficients_;
186 gko::detail::DenseCache<ValueType> host_coefficients_;
208 template <
typename ValueType>
209 std::shared_ptr<const Nullspace<ValueType>> prepare_nullspace(
210 std::shared_ptr<const LinOp> param,
const char* name,
const LinOp* op,
211 size_type size, std::shared_ptr<const Executor> exec);
219 #endif // GKO_PUBLIC_CORE_SOLVER_NULLSPACE_HPP_