Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
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#include <ginkgo/core/base/executor.hpp>
12
13
14namespace gko {
15namespace matrix {
16
17
18template <typename ValueType>
19class Dense;
20
21
22}
23
24
25namespace detail {
26
27
37template <typename ValueType>
38struct DenseCache {
39 DenseCache() = default;
40 ~DenseCache() = default;
41 DenseCache(const DenseCache&) {}
42 DenseCache(DenseCache&&) noexcept {}
43 DenseCache& operator=(const DenseCache&) { return *this; }
44 DenseCache& operator=(DenseCache&&) noexcept { return *this; }
45 mutable std::unique_ptr<matrix::Dense<ValueType>> vec{};
46
47
60 void init_from(const matrix::Dense<ValueType>* template_vec) const;
61
71 void init(std::shared_ptr<const Executor> exec, dim<2> size) const;
72
77 matrix::Dense<ValueType>& operator*() const { return *vec; }
78
83 matrix::Dense<ValueType>* operator->() const { return vec.get(); }
84
89 matrix::Dense<ValueType>* get() const { return vec.get(); }
90};
91
92
93} // namespace detail
94} // namespace gko
95
96
97#endif // GKO_PUBLIC_CORE_BASE_DENSE_CACHE_HPP_
Dense is a matrix format which explicitly stores all values of the matrix.
Definition sparsity_csr.hpp:25
The Ginkgo namespace.
Definition abstract_factory.hpp:20