5#ifndef GKO_PUBLIC_CORE_MATRIX_FBCSR_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_FBCSR_HPP_
9#include <ginkgo/core/base/array.hpp>
10#include <ginkgo/core/base/lin_op.hpp>
11#include <ginkgo/core/base/math.hpp>
18template <
typename ValueType>
21template <
typename ValueType,
typename IndexType>
24template <
typename ValueType,
typename IndexType>
27template <
typename ValueType,
typename IndexType>
30template <
typename ValueType,
typename IndexType>
47template <
typename IndexType>
48inline IndexType get_num_blocks(
const int block_size,
const IndexType size)
50 GKO_ASSERT_BLOCK_SIZE_CONFORMANT(size, block_size);
51 return size / block_size;
97template <
typename ValueType = default_precision,
typename IndexType =
int32>
99 public ConvertibleTo<Fbcsr<next_precision<ValueType>, IndexType>>,
100#if GINKGO_ENABLE_HALF
102 Fbcsr<next_precision<next_precision<ValueType>>, IndexType>>,
112 remove_complex<Fbcsr<ValueType, IndexType>>> {
114 friend class Csr<ValueType, IndexType>;
115 friend class Dense<ValueType>;
121 using value_type = ValueType;
122 using index_type = IndexType;
151 friend class Fbcsr<previous_precision<ValueType>, IndexType>;
158#if GINKGO_ENABLE_HALF
159 friend class Fbcsr<previous_precision<previous_precision<ValueType>>,
162 IndexType>>::convert_to;
167 result)
const override;
312 return this->get_size()[0] / bs_;
320 return this->get_size()[1] / bs_;
332 static std::unique_ptr<Fbcsr>
create(std::shared_ptr<const Executor> exec,
346 static std::unique_ptr<Fbcsr>
create(std::shared_ptr<const Executor> exec,
371 static std::unique_ptr<Fbcsr>
create(std::shared_ptr<const Executor> exec,
372 const dim<2>& size,
int block_size,
382 template <
typename InputValueType,
typename InputColumnIndexType,
383 typename InputRowPtrType>
385 "explicitly construct the gko::array argument instead of passing "
389 int block_size,
std::initializer_list<InputValueType> values,
390 std::initializer_list<InputColumnIndexType> col_idxs,
391 std::initializer_list<InputRowPtrType> row_ptrs)
393 return create(exec, size, block_size,
414 std::shared_ptr<const Executor> exec,
const dim<2>& size,
int blocksize,
415 gko::detail::const_array_view<ValueType>&& values,
416 gko::detail::const_array_view<IndexType>&& col_idxs,
417 gko::detail::const_array_view<IndexType>&& row_ptrs);
445 Fbcsr(std::shared_ptr<const Executor> exec,
int block_size = 1);
447 Fbcsr(std::shared_ptr<const Executor> exec,
const dim<2>& size,
450 Fbcsr(std::shared_ptr<const Executor> exec,
const dim<2>& size,
454 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
457 LinOp* x)
const override;
Definition polymorphic_object.hpp:479
Definition lin_op.hpp:793
Definition lin_op.hpp:878
Definition polymorphic_object.hpp:668
Definition executor.hpp:615
Definition lin_op.hpp:117
Definition lin_op.hpp:605
Definition lin_op.hpp:433
Definition lin_op.hpp:660
value_type * get_data() noexcept
Definition array.hpp:673
const value_type * get_const_data() const noexcept
Definition array.hpp:682
size_type get_size() const noexcept
Definition array.hpp:656
Definition device_matrix_data.hpp:36
Fixed-block compressed sparse row storage matrix format.
Definition fbcsr.hpp:112
void read(device_mat_data &&data) override
size_type get_num_stored_blocks() const noexcept
Definition fbcsr.hpp:297
std::unique_ptr< LinOp > transpose() const override
void read(const device_mat_data &data) override
size_type get_num_stored_elements() const noexcept
Definition fbcsr.hpp:289
const value_type * get_const_values() const noexcept
Definition fbcsr.hpp:247
const index_type * get_const_col_idxs() const noexcept
Definition fbcsr.hpp:264
index_type get_num_block_rows() const noexcept
Definition fbcsr.hpp:310
index_type * get_row_ptrs() noexcept
Definition fbcsr.hpp:272
int get_block_size() const noexcept
Definition fbcsr.hpp:305
index_type * get_col_idxs() noexcept
Definition fbcsr.hpp:255
static std::unique_ptr< Fbcsr > create(std::shared_ptr< const Executor > exec, int block_size=1)
void write(mat_data &data) const override
static std::unique_ptr< const Fbcsr > create_const(std::shared_ptr< const Executor > exec, const dim< 2 > &size, int blocksize, gko::detail::const_array_view< ValueType > &&values, gko::detail::const_array_view< IndexType > &&col_idxs, gko::detail::const_array_view< IndexType > &&row_ptrs)
void compute_absolute_inplace() override
static std::unique_ptr< Fbcsr > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size, size_type num_nonzeros, int block_size)
void sort_by_column_index()
value_type * get_values() noexcept
Definition fbcsr.hpp:238
std::unique_ptr< LinOp > conj_transpose() const override
Fbcsr & operator=(Fbcsr &&)
std::unique_ptr< absolute_type > compute_absolute() const override
std::unique_ptr< Diagonal< ValueType > > extract_diagonal() const override
const index_type * get_const_row_ptrs() const noexcept
Definition fbcsr.hpp:281
Fbcsr & operator=(const Fbcsr &)
void convert_to(Csr< ValueType, IndexType > *result) const override
static std::unique_ptr< Fbcsr > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size, int block_size, array< value_type > values, array< index_type > col_idxs, array< index_type > row_ptrs)
void read(const mat_data &data) override
bool is_sorted_by_column_index() const
index_type get_num_block_cols() const noexcept
Definition fbcsr.hpp:318
void convert_to(SparsityCsr< ValueType, IndexType > *result) const override
Definition sparsity_csr.hpp:55
The Ginkgo namespace.
Definition abstract_factory.hpp:20
typename detail::next_precision_impl< T >::type next_precision
Definition math.hpp:438
std::size_t size_type
Definition types.hpp:89
typename detail::to_complex_s< T >::type to_complex
Definition math.hpp:279
typename detail::remove_complex_s< T >::type remove_complex
Definition math.hpp:260
Definition matrix_data.hpp:126