Ginkgo  Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
dense_cache.hpp
1 // SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_BASE_DENSE_CACHE_HPP_
6 #define GKO_PUBLIC_CORE_BASE_DENSE_CACHE_HPP_
7 
8 
9 #include <memory>
10 
11 
12 #include <ginkgo/core/base/executor.hpp>
13 
14 
15 namespace gko {
16 namespace matrix {
17 
18 
19 template <typename ValueType>
20 class Dense;
21 
22 
23 }
24 
25 
26 namespace detail {
27 
28 
38 template <typename ValueType>
39 struct DenseCache {
40  DenseCache() = default;
41  ~DenseCache() = default;
42  DenseCache(const DenseCache&) {}
43  DenseCache(DenseCache&&) noexcept {}
44  DenseCache& operator=(const DenseCache&) { return *this; }
45  DenseCache& operator=(DenseCache&&) noexcept { return *this; }
46  mutable std::unique_ptr<matrix::Dense<ValueType>> vec{};
47 
48 
61  void init_from(const matrix::Dense<ValueType>* template_vec) const;
62 
72  void init(std::shared_ptr<const Executor> exec, dim<2> size) const;
73 
78  matrix::Dense<ValueType>& operator*() const { return *vec; }
79 
84  matrix::Dense<ValueType>* operator->() const { return vec.get(); }
85 
90  matrix::Dense<ValueType>* get() const { return vec.get(); }
91 };
92 
93 
94 } // namespace detail
95 } // namespace gko
96 
97 
98 #endif // GKO_PUBLIC_CORE_BASE_DENSE_CACHE_HPP_
gko::matrix::Dense
Dense is a matrix format which explicitly stores all values of the matrix.
Definition: dense_cache.hpp:20
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20