Skip to content

Commit

Permalink
Remove create_multivector_view
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Oct 9, 2023
1 parent b366ea7 commit d28ddd3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
32 changes: 0 additions & 32 deletions core/matrix/batch_dense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,38 +64,6 @@ GKO_REGISTER_OPERATION(advanced_apply, batch_dense::advanced_apply);
} // namespace dense


template <typename ValueType>
std::unique_ptr<gko::batch::MultiVector<ValueType>>
Dense<ValueType>::create_multi_vector_view()
{
auto exec = this->get_executor();
auto num_batch_items = this->get_num_batch_items();
auto num_rows = this->get_common_size()[0];
auto stride = this->get_common_size()[1];
auto mvec = MultiVector<ValueType>::create(
exec, this->get_size(),
make_array_view(exec, num_batch_items * num_rows * stride,
this->get_values()));
return mvec;
}


template <typename ValueType>
std::unique_ptr<const gko::batch::MultiVector<ValueType>>
Dense<ValueType>::create_const_multi_vector_view() const
{
auto exec = this->get_executor();
auto num_batch_items = this->get_num_batch_items();
auto num_rows = this->get_common_size()[0];
auto stride = this->get_common_size()[1];
auto mvec = MultiVector<ValueType>::create_const(
exec, this->get_size(),
make_const_array_view(exec, num_batch_items * num_rows * stride,
this->get_const_values()));
return mvec;
}


template <typename ValueType>
std::unique_ptr<gko::matrix::Dense<ValueType>>
Dense<ValueType>::create_view_for_item(size_type item_id)
Expand Down
7 changes: 0 additions & 7 deletions core/test/matrix/batch_dense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ TYPED_TEST(Dense, CanCreateDenseItemView)
}


TYPED_TEST(Dense, CanCreateMultiVectorView)
{
GKO_ASSERT_BATCH_MTX_NEAR(this->mtx->create_multi_vector_view(), this->mvec,
0.0);
}


TYPED_TEST(Dense, CanBeCopied)
{
auto mtx_copy = gko::batch::matrix::Dense<TypeParam>::create(this->exec);
Expand Down
20 changes: 2 additions & 18 deletions include/ginkgo/core/matrix/batch_dense.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,6 @@ class Dense final : public EnableBatchLinOp<Dense<ValueType>>,

void move_to(Dense<next_precision<ValueType>>* result) override;

/**
* Creates a mutable view (of MultiVector type) of the data owned by the
* matrix::Dense object. Does not perform any deep copies, but only
* returns a view of the underlying data.
*
* @return a MultiVector object with a view of the data from the batch
* dense matrix.
*/
std::unique_ptr<MultiVector<value_type>> create_multi_vector_view();

/**
* @copydoc create_const_multi_vector_view()
*/
std::unique_ptr<const MultiVector<value_type>>
create_const_multi_vector_view() const;

/**
* Creates a mutable view (of gko::matrix::Dense type) of one item of the
* batch::matrix::Dense<value_type> object. Does not perform any deep
Expand Down Expand Up @@ -234,8 +218,8 @@ class Dense final : public EnableBatchLinOp<Dense<ValueType>>,
* significantly more memory efficient than the non-constant version,
* so always prefer this version.
*/
const value_type* get_const_values_for_item(
size_type batch_id) const noexcept
const value_type* get_const_values_for_item(size_type batch_id) const
noexcept
{
GKO_ASSERT(batch_id < this->get_num_batch_items());
return values_.get_const_data() +
Expand Down

0 comments on commit d28ddd3

Please sign in to comment.