This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class C> | |
inline void xstepper<C>::step(size_type dim, size_type n) | |
{ | |
if (dim >= m_offset) | |
{ | |
m_it += difference_type(n * p_c->strides()[dim - m_offset]); | |
} | |
} | |
template <class C> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xarray<int> a = {{0, 1, 2, 3}, | |
{4, 5, 6, 7}, | |
{8, 9, 10, 11}}; | |
xarray<int> b = {0, 1, 2, 3}; | |
auto r = a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class C> | |
class xstepper | |
{ | |
public: | |
using storage_type = C; | |
using subiterator_type = get_stepper_iterator<C>; | |
// Same public API as xfunction_stepper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class F, class... CT> | |
inline void xfunction_stepper<F, CT...>::step(size_type dim, size_type n) | |
{ | |
auto f = [dim, n](auto& st) { st.step(dim, n); }; | |
for_each(f, m_st); | |
} | |
template <class F, class... CT> | |
inline void xfunction_stepper<F, CT...>::step_back(size_type dim, size_type n) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class F, class... CT> | |
class xfunction_stepper | |
{ | |
public: | |
using xfunction_type = xfunction<F, CT...>; | |
using value_type = typename xfunction_type::value_type; | |
using reference = typename xfunction_type::value_type; | |
using pointer = typename xfunction_type::const_pointer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class F, class... CT> | |
class xfunction_stepper | |
{ | |
public: | |
using xfunction_type = xfunction<F, CT...>; | |
using value_type = typename xfunction_type::value_type; | |
using reference = typename xfunction_type::value_type; | |
using pointer = typename xfunction_type::const_pointer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reference operator*() const; | |
void step(size_type dim, size_type n = 1); | |
void step_back(size_type dim, size_type n = 1); | |
void reset(size_type dim); | |
void reset_back(size_type dim); | |
void to_begin(); | |
void to_end(layout_type l); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, layout_type L, class A> | |
template <layout_type IL = XTENSOR_DEFAULT_TRAVERSAL> | |
inline select_iterator<IL> xarray<T, L, A>::begin() const | |
{ | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class S> | |
auto data_offset(const S&) noexcept | |
{ | |
return typename S::value_type(0); | |
} | |
template <class S, class I, class... Args> | |
auto data_offset(const S& strides, I i, Args... args) noexcept | |
{ | |
constexpr std::size_t nargs = sizeof...(Args) + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <size_t dim = 0, class S> | |
auto raw_data_offset(const S&) noexcept | |
{ | |
return typename S::value_type(0); | |
} | |
template <size_t dim = 0, class S, class I, class... Args> | |
auto raw_data_offset(const S& strides, I i, Args... args) noexcept | |
{ | |
return i * strides[dim] + raw_data_offset<dim + 1>(strides, |