Ginkgo: ginkgo/core/matrix/batch_identity.hpp Source File

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
batch_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_BATCH_IDENTITY_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_BATCH_IDENTITY_HPP_
7
8
9#include <ginkgo/core/base/batch_lin_op.hpp>
10#include <ginkgo/core/base/batch_multi_vector.hpp>
11#include <ginkgo/core/base/executor.hpp>
12#include <ginkgo/core/base/types.hpp>
13#include <ginkgo/core/base/utils.hpp>
14#include <ginkgo/core/matrix/identity.hpp>
15
16
17namespace gko {
18namespace batch {
19namespace matrix {
20
21
31template <typename ValueType = default_precision>
32 class Identity final : public EnableBatchLinOp<Identity<ValueType>> {
33 friend class EnablePolymorphicObject<Identity, BatchLinOp>;
34 GKO_ASSERT_SUPPORTED_VALUE_TYPE;
35
36public:
37 using value_type = ValueType;
38 using index_type = int32;
39 using unbatch_type = gko::matrix::Identity<ValueType>;
40 using absolute_type = remove_complex<Identity>;
41 using complex_type = to_complex<Identity>;
42
50 Identity* apply(ptr_param<const MultiVector<value_type>> b,
51 ptr_param<MultiVector<value_type>> x);
52
63 Identity* apply(ptr_param<const MultiVector<value_type>> alpha,
64 ptr_param<const MultiVector<value_type>> b,
65 ptr_param<const MultiVector<value_type>> beta,
66 ptr_param<MultiVector<value_type>> x);
67
71 const Identity* apply(ptr_param<const MultiVector<value_type>> b,
72 ptr_param<MultiVector<value_type>> x) const;
73
79 const Identity* apply(ptr_param<const MultiVector<value_type>> alpha,
80 ptr_param<const MultiVector<value_type>> b,
81 ptr_param<const MultiVector<value_type>> beta,
82 ptr_param<MultiVector<value_type>> x) const;
91 static std::unique_ptr<Identity> create(
92 std::shared_ptr<const Executor> exec,
93 const batch_dim<2>& size = batch_dim<2>{});
94
95private:
96 Identity(std::shared_ptr<const Executor> exec,
97 const batch_dim<2>& size = batch_dim<2>{});
98
99 void apply_impl(const MultiVector<value_type>* b,
100 MultiVector<value_type>* x) const;
101
102 void apply_impl(const MultiVector<value_type>* alpha,
103 const MultiVector<value_type>* b,
104 const MultiVector<value_type>* beta,
105 MultiVector<value_type>* x) const;
106};
107
108
109} // namespace matrix
110} // namespace batch
111} // namespace gko
112
113
114#endif // GKO_PUBLIC_CORE_MATRIX_BATCH_IDENTITY_HPP_
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
gko::batch::BatchLinOp
Definition batch_lin_op.hpp:59
gko::batch::EnableBatchLinOp
The EnableBatchLinOp mixin can be used to provide sensible default implementations of the majority of...
Definition batch_lin_op.hpp:252
gko::batch::MultiVector
MultiVector stores multiple vectors in a batched fashion and is useful for batched operations.
Definition batch_multi_vector.hpp:61
gko::batch::matrix::Identity
The batch Identity matrix, which represents a batch of Identity matrices.
Definition batch_identity.hpp:32
gko::batch::matrix::Identity::apply
Identity * apply(ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x)
Apply the matrix to a multi-vector with a linear combination of the given input vector.
gko::batch::matrix::Identity::apply
const Identity * apply(ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x) const
gko::batch::matrix::Identity::apply
Identity * apply(ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x)
Apply the matrix to a multi-vector.
gko::batch::matrix::Identity::create
static std::unique_ptr< Identity > create(std::shared_ptr< const Executor > exec, const batch_dim< 2 > &size=batch_dim< 2 >{})
Creates an Identity matrix of the specified size.
gko::batch::matrix::Identity::apply
const Identity * apply(ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x) const
gko::matrix::Identity
This class is a utility which efficiently implements the identity matrix (a linear operator which map...
Definition identity.hpp:35
gko::ptr_param
This class is used for function parameters in the place of raw pointers.
Definition utils_helper.hpp:41
gko
The Ginkgo namespace.
Definition abstract_factory.hpp:20
gko::remove_complex
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:264
gko::int32
std::int32_t int32
32-bit signed integral type.
Definition types.hpp:107
gko::to_complex
typename detail::to_complex_s< T >::type to_complex
Obtain the type which adds the complex of complex/scalar type or the template parameter of class by a...
Definition math.hpp:283
gko::batch_dim
A type representing the dimensions of a multidimensional batch object.
Definition batch_dim.hpp:27