ginkgo/core/matrix/identity.hpp Source File

ginkgo/core/matrix/identity.hpp Source File#

Reference API: ginkgo/core/matrix/identity.hpp Source File
Reference API
identity.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_MATRIX_IDENTITY_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_IDENTITY_HPP_
7
8
9#include <ginkgo/core/base/lin_op.hpp>
10
11
12namespace gko {
13namespace matrix {
14
15
33template <typename ValueType = default_precision>
34class Identity : public EnableLinOp<Identity<ValueType>>, public Transposable {
36
37public:
40
41 using value_type = ValueType;
43
44 std::unique_ptr<LinOp> transpose() const override;
45
46 std::unique_ptr<LinOp> conj_transpose() const override;
47
53 GKO_DEPRECATED("use the version taking a size_type instead of dim<2>")
54 static std::unique_ptr<Identity> create(
55 std::shared_ptr<const Executor> exec, dim<2> size);
56
62 static std::unique_ptr<Identity> create(
63 std::shared_ptr<const Executor> exec, size_type size = 0);
64
65protected:
66 explicit Identity(std::shared_ptr<const Executor> exec, size_type size = 0);
67
68 void apply_impl(const LinOp* b, LinOp* x) const override;
69
70 void apply_impl(const LinOp* alpha, const LinOp* b, const LinOp* beta,
71 LinOp* x) const override;
72};
73
74
86template <typename ValueType = default_precision>
90
91public:
92 using value_type = ValueType;
93
101 static std::unique_ptr<IdentityFactory> create(
102 std::shared_ptr<const Executor> exec)
103 {
104 return std::unique_ptr<IdentityFactory>(
105 new IdentityFactory(std::move(exec)));
106 }
107
108protected:
109 std::unique_ptr<LinOp> generate_impl(
110 std::shared_ptr<const LinOp> base) const override;
111
112 IdentityFactory(std::shared_ptr<const Executor> exec)
114 {}
115};
116
117
118} // namespace matrix
119} // namespace gko
120
121
122#endif // GKO_PUBLIC_CORE_MATRIX_IDENTITY_HPP_
Definition lin_op.hpp:878
void move_to(result_type *result) override
Definition polymorphic_object.hpp:751
void convert_to(result_type *result) const override
Definition polymorphic_object.hpp:749
Definition polymorphic_object.hpp:668
Definition executor.hpp:615
Definition lin_op.hpp:385
Definition lin_op.hpp:117
Definition lin_op.hpp:433
Definition identity.hpp:88
static std::unique_ptr< IdentityFactory > create(std::shared_ptr< const Executor > exec)
Definition identity.hpp:101
Definition identity.hpp:34
static std::unique_ptr< Identity > create(std::shared_ptr< const Executor > exec, dim< 2 > size)
std::unique_ptr< LinOp > conj_transpose() const override
std::unique_ptr< LinOp > transpose() const override
The Ginkgo namespace.
Definition abstract_factory.hpp:20
double default_precision
Definition types.hpp:171
std::size_t size_type
Definition types.hpp:89
STL namespace.
Definition dim.hpp:26