Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented csr scheme and iterator #33

Merged
merged 4 commits into from Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/xtensor-sparse/xcoo_scheme.hpp
Expand Up @@ -43,9 +43,10 @@ namespace xt
void insert_element(const index_type& index, const_reference value);
void remove_element(const index_type& index);

template<class strides_type>
template <class strides_type, class shape_type>
void update_entries(const strides_type& old_strides,
const strides_type& new_strides);
const strides_type& new_strides,
const shape_type& new_shape);

iterator begin();
iterator end();
Expand Down Expand Up @@ -217,9 +218,10 @@ namespace xt
}

template <class P, class C, class ST, class IT>
template<class strides_type>
template <class strides_type, class shape_type>
inline void xcoo_scheme<P, C, ST, IT>::update_entries(const strides_type& old_strides,
const strides_type& new_strides)
const strides_type& new_strides,
const shape_type&)
{
coordinate_type new_coords;

Expand Down
18 changes: 10 additions & 8 deletions include/xtensor-sparse/xcsf_scheme.hpp
Expand Up @@ -44,9 +44,10 @@ namespace xt
void insert_element(const index_type& index, const_reference value);
void remove_element(const index_type& index);

template<class strides_type>
template <class strides_type, class shape_type>
void update_entries(const strides_type& old_strides,
const strides_type& new_strides);
const strides_type& new_strides,
const shape_type& new_shape);

iterator begin();
iterator end();
Expand Down Expand Up @@ -105,7 +106,7 @@ namespace xt

namespace detail
{
template<class Pos, class Coord, class Func, class Index>
template <class Pos, class Coord, class Func, class Index>
void for_each_sparse_impl(std::integral_constant<std::size_t, 0>, std::size_t i, std::size_t ielem, const Pos& pos, const Coord& coord, Index& index, Func&& f)
{
for(std::size_t p = pos[i][ielem]; p<pos[i][ielem + 1]; ++p)
Expand All @@ -115,7 +116,7 @@ namespace xt
}
}

template<class Pos, class Coord, class Func, class Index>
template <class Pos, class Coord, class Func, class Index>
void for_each_sparse_impl(std::integral_constant<std::size_t, 1>, std::size_t i, std::size_t ielem, const Pos& pos, const Coord& coord, Index& index, Func&& f)
{
for(std::size_t p = pos[i][ielem]; p<pos[i][ielem + 1]; ++p)
Expand All @@ -132,7 +133,7 @@ namespace xt
}
}

template<class Pos, class Coord, class Func>
template <class Pos, class Coord, class Func>
void for_each(const Pos& pos, const Coord& coord, Func&& f)
{
std::vector<std::size_t> index(pos.size());
Expand All @@ -146,7 +147,7 @@ namespace xt
}
}

template<class Pos, class Coord, class Index>
template <class Pos, class Coord, class Index>
std::size_t insert_index(Pos& pos, Coord& coord, const Index& index)
{
std::size_t ielem = 0;
Expand Down Expand Up @@ -279,9 +280,10 @@ namespace xt
}

template <class P, class C, class ST, class IT>
template<class strides_type>
template <class strides_type, class shape_type>
inline void xcsf_scheme<P, C, ST, IT>::update_entries(const strides_type& old_strides,
const strides_type& new_strides)
const strides_type& new_strides,
const shape_type&)
{
coordinate_type new_coords;
position_type new_pos;
Expand Down