Gyselalib++
 
Loading...
Searching...
No Matches
matrix_batch.hpp
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
5#include "sll/view.hpp"
6
7
21template <typename ExecSpace>
23{
24public:
26 using BatchedRHS = Kokkos::View<double**, Kokkos::LayoutRight, ExecSpace>;
27
28
29private:
30 std::size_t m_size;
31 std::size_t m_batch_size;
32
33protected:
39 explicit MatrixBatch(const std::size_t batch_size, const std::size_t mat_size)
40 : m_size(mat_size)
41 , m_batch_size(batch_size)
42 {
43 }
44
45public:
47 virtual ~MatrixBatch() = default;
48
52 virtual void setup_solver() = 0;
53
59 virtual void solve(BatchedRHS b) const = 0;
60
66 std::size_t size() const
67 {
68 return m_size;
69 }
70
76 std::size_t batch_size() const
77 {
78 return m_batch_size;
79 }
80};
MatrixBatch superclass for managing a collection of linear systems.
Definition matrix_batch.hpp:23
std::size_t batch_size() const
Get the batch size of the linear problem.
Definition matrix_batch.hpp:76
std::size_t size() const
Get the size of the square matrix corresponding to a single batch in one of its dimensions.
Definition matrix_batch.hpp:66
virtual void setup_solver()=0
Perform a pre-process operation on the solver.
MatrixBatch(const std::size_t batch_size, const std::size_t mat_size)
The constructor for MatrixBatch class.
Definition matrix_batch.hpp:39
Kokkos::View< double **, Kokkos::LayoutRight, ExecSpace > BatchedRHS
The type of a Kokkos::View storing batched right-hand sides. Second dimenion is batch dimension.
Definition matrix_batch.hpp:26
virtual ~MatrixBatch()=default
Destruct.
virtual void solve(BatchedRHS b) const =0
Solve the multiple right-hand sides linear problem Ax=b inplace.