10#ifndef XTENSOR_FUNCTOR_VIEW_HPP
11#define XTENSOR_FUNCTOR_VIEW_HPP
19#include <xtl/xproxy_wrapper.hpp>
21#include "xaccessible.hpp"
23#include "xexpression.hpp"
24#include "xiterator.hpp"
25#include "xsemantic.hpp"
44 template <
class Tag,
class F,
class CT>
47 template <
class F,
class CT>
53 template <
class F,
class CT>
58 template <
class F,
class CT>
66 template <
class F,
class IT>
69 template <
class F,
class ST>
79 using xexpression_type =
typename inner_types::xexpression_type;
80 using undecay_expression =
typename inner_types::undecay_expression;
81 using functor_type =
typename inner_types::functor_type;
82 using accessible_base = xaccessible<D>;
84 using extension_base = extension::xfunctor_view_base_t<functor_type, undecay_expression>;
85 using expression_tag =
typename extension_base::expression_tag;
87 using value_type =
typename functor_type::value_type;
88 using reference =
typename inner_types::reference;
89 using const_reference =
typename inner_types::const_reference;
90 using pointer =
typename functor_type::pointer;
91 using const_pointer =
typename functor_type::const_pointer;
92 using size_type =
typename inner_types::size_type;
93 using difference_type =
typename xexpression_type::difference_type;
95 using shape_type =
typename xexpression_type::shape_type;
96 using strides_type = xtl::mpl::eval_if_t<
98 detail::expr_strides_type<xexpression_type>,
100 using backstrides_type = xtl::mpl::eval_if_t<
102 detail::expr_backstrides_type<xexpression_type>,
105 using inner_shape_type =
typename xexpression_type::inner_shape_type;
106 using inner_strides_type = xtl::mpl::eval_if_t<
108 detail::expr_inner_strides_type<xexpression_type>,
110 using inner_backstrides_type = xtl::mpl::eval_if_t<
112 detail::expr_inner_backstrides_type<xexpression_type>,
115 using bool_load_type = xt::bool_load_type<value_type>;
117 static constexpr layout_type static_layout = xexpression_type::static_layout;
118 static constexpr bool contiguous_layout = xexpression_type::contiguous_layout;
123 template <layout_type L>
125 template <layout_type L>
128 typename xexpression_type::template const_layout_iterator<L>>;
130 template <layout_type L>
133 typename xexpression_type::template reverse_layout_iterator<L>>;
134 template <layout_type L>
137 typename xexpression_type::template const_reverse_layout_iterator<L>>;
139 template <
class S, layout_type L>
141 template <
class S, layout_type L>
146 template <
class S, layout_type L>
149 typename xexpression_type::template reverse_broadcast_iterator<S, L>>;
150 template <
class S, layout_type L>
153 typename xexpression_type::template const_reverse_broadcast_iterator<S, L>>;
160 typename xexpression_type::const_reverse_linear_iterator>;
169 template <
class Func,
class E>
172 size_type
size() const noexcept;
173 const inner_shape_type&
shape() const noexcept;
174 const inner_strides_type&
strides() const noexcept;
177 using accessible_base::
shape;
180 bool is_contiguous() const noexcept;
182 template <class... Args>
183 reference operator()(Args... args);
185 template <class... Args>
186 reference unchecked(Args... args);
189 reference element(IT first, IT last);
191 template <class... Args>
192 const_reference operator()(Args... args) const;
194 template <class... Args>
195 const_reference unchecked(Args... args) const;
198 const_reference element(IT first, IT last) const;
200 using accessible_base::at;
201 using accessible_base::operator[];
202 using accessible_base::
back;
203 using accessible_base::
front;
204 using accessible_base::periodic;
217 template <class FCT = functor_type>
218 auto data_element(size_type i)
219 -> decltype(std::declval<FCT>()(std::declval<undecay_expression>().data_element(i)))
221 return m_functor(m_e.data_element(i));
224 template <
class FCT = functor_type>
225 auto data_element(size_type i)
const
226 ->
decltype(std::declval<FCT>()(std::declval<const undecay_expression>().data_element(i)))
228 return m_functor(m_e.data_element(i));
231 template <
class FCT = functor_type>
232 auto flat(size_type i) ->
decltype(std::declval<FCT>()(std::declval<undecay_expression>().flat(i)))
234 return m_functor(m_e.flat(i));
237 template <
class FCT = functor_type>
238 auto flat(size_type i)
const
239 ->
decltype(std::declval<FCT>()(std::declval<const undecay_expression>().flat(i)))
241 return m_functor(m_e.flat(i));
248 class requested_type =
typename xexpression_type::value_type,
249 std::size_t N = xt_simd::simd_traits<requested_type>::size,
250 class FCT = functor_type>
251 auto load_simd(size_type i)
const
252 ->
decltype(std::declval<FCT>().template proxy_simd_load<align, requested_type, N>(
253 std::declval<undecay_expression>(),
257 return m_functor.template proxy_simd_load<align, requested_type, N>(m_e, i);
260 template <
class align,
class simd,
class FCT = functor_type>
261 auto store_simd(size_type i,
const simd& e)
262 ->
decltype(std::declval<FCT>()
263 .template proxy_simd_store<align>(std::declval<undecay_expression>(), i, e))
265 return m_functor.template proxy_simd_store<align>(m_e, i, e);
268 template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
270 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
273 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
275 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
276 auto
end() const noexcept;
277 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
279 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
282 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
284 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
287 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
289 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
291 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
293 template <
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
296 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
297 broadcast_iterator<S, L>
begin(const S&
shape) noexcept;
298 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
299 broadcast_iterator<S, L>
end(const S&
shape) noexcept;
301 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
302 const_broadcast_iterator<S, L>
begin(const S&
shape) const noexcept;
303 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
304 const_broadcast_iterator<S, L>
end(const S&
shape) const noexcept;
305 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
306 const_broadcast_iterator<S, L>
cbegin(const S&
shape) const noexcept;
307 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
308 const_broadcast_iterator<S, L>
cend(const S&
shape) const noexcept;
310 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
311 reverse_broadcast_iterator<S, L>
rbegin(const S&
shape) noexcept;
312 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
313 reverse_broadcast_iterator<S, L>
rend(const S&
shape) noexcept;
315 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
316 const_reverse_broadcast_iterator<S, L>
rbegin(const S&
shape) const noexcept;
317 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
318 const_reverse_broadcast_iterator<S, L>
rend(const S&
shape) const noexcept;
319 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
320 const_reverse_broadcast_iterator<S, L>
crbegin(const S&
shape) const noexcept;
321 template <class S,
layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
322 const_reverse_broadcast_iterator<S, L>
crend(const S&
shape) const noexcept;
324 linear_iterator linear_begin() noexcept;
325 linear_iterator linear_end() noexcept;
327 const_linear_iterator linear_begin() const noexcept;
328 const_linear_iterator linear_end() const noexcept;
329 const_linear_iterator linear_cbegin() const noexcept;
330 const_linear_iterator linear_cend() const noexcept;
332 reverse_linear_iterator linear_rbegin() noexcept;
333 reverse_linear_iterator linear_rend() noexcept;
335 const_reverse_linear_iterator linear_rbegin() const noexcept;
336 const_reverse_linear_iterator linear_rend() const noexcept;
337 const_reverse_linear_iterator linear_crbegin() const noexcept;
338 const_reverse_linear_iterator linear_crend() const noexcept;
341 stepper stepper_begin(const S&
shape) noexcept;
345 const_stepper stepper_begin(const S&
shape) const noexcept;
351 undecay_expression m_e;
352 functor_type m_functor;
356 friend class xaccessible<D>;
360 template <class D, class T>
376 template <
class F,
class S, layout_type L>
377 struct functorview_temporary_type_impl
382 template <
class F,
class T, std::
size_t N, layout_type L>
383 struct functorview_temporary_type_impl<F, std::array<T, N>, L>
385 using type = xtensor<typename F::value_type, N, L>;
389 template <
class F,
class E>
392 using type =
typename detail::functorview_temporary_type_impl<F, typename E::shape_type, E::static_layout>::type;
399 template <
class F,
class CT>
402 template <
class F,
class CT>
405 using xexpression_type = std::decay_t<CT>;
406 using undecay_expression = CT;
407 using functor_type = std::decay_t<F>;
408 using reference =
decltype(std::declval<F>()(std::declval<xexpression_type>()()));
409 using const_reference =
decltype(std::declval<F>()(std::declval<const xexpression_type>()()));
410 using size_type =
typename xexpression_type::size_type;
411 using temporary_type =
typename xfunctor_view_temporary_type<F, xexpression_type>::type;
414 template <
class F,
class CT,
class T>
439 template <
class F,
class CT>
441 public xview_semantic<xfunctor_view<F, CT>>,
442 public extension::xfunctor_view_base_t<F, CT>
447 using semantic_base = xview_semantic<self_type>;
456 disable_xexpression<E, self_type>& operator=(
const E& e);
462 rebind_t<E> build_functor_view(E&& e)
const;
467 void assign_temporary_impl(temporary_type&& tmp);
468 friend class xview_semantic<self_type>;
476 template <
class F,
class CT>
479 template <
class F,
class CT>
482 using xexpression_type = std::decay_t<CT>;
483 using undecay_expression = CT;
484 using functor_type = std::decay_t<F>;
485 using reference =
typename functor_type::reference;
486 using const_reference =
typename functor_type::const_reference;
487 using size_type =
typename xexpression_type::size_type;
488 using temporary_type =
typename xfunctor_view_temporary_type<F, xexpression_type>::type;
491 template <
class F,
class CT,
class T>
508 template <
class F,
class CT>
510 public xcontainer_semantic<xfunctor_adaptor<F, CT>>,
511 public extension::xfunctor_view_base_t<F, CT>
516 using semantic_base = xcontainer_semantic<self_type>;
517 using xexpression_type = std::decay_t<CT>;
519 using shape_type =
typename base_type::shape_type;
520 using strides_type =
typename xexpression_type::strides_type;
528 disable_xexpression<E, self_type>& operator=(
const E& e);
530 template <
class S = shape_type>
531 auto resize(S&&
shape,
bool force =
false);
533 template <
class S = shape_type>
536 template <
class S = shape_type>
539 template <
class S = shape_type>
545 void assign_temporary_impl(temporary_type&& tmp);
546 friend class xcontainer_semantic<self_type>;
558 using pointer = std::add_pointer_t<std::remove_reference_t<R>>;
563 template <
class F,
class IT>
564 struct xfunctor_invoker
566 using type =
decltype(std::declval<F>()(*(std::declval<IT>())));
569 template <
class F,
class IT>
570 using xfunctor_invoker_t =
typename xfunctor_invoker<F, IT>::type;
573 template <
class F,
class IT>
574 class xfunctor_iterator :
public xtl::xrandom_access_iterator_base<
575 xfunctor_iterator<F, IT>,
576 typename std::decay_t<F>::value_type,
577 typename std::iterator_traits<IT>::difference_type,
578 typename xproxy_inner_types<detail::xfunctor_invoker_t<F, IT>>::pointer,
579 typename xproxy_inner_types<detail::xfunctor_invoker_t<F, IT>>::reference>
583 using functor_type = F;
584 using subiterator_traits = std::iterator_traits<IT>;
587 using value_type =
typename functor_type::value_type;
588 using reference =
typename proxy_inner::reference;
589 using pointer =
typename proxy_inner::pointer;
590 using difference_type =
typename subiterator_traits::difference_type;
591 using iterator_category =
typename subiterator_traits::iterator_category;
593 using self_type = xfunctor_iterator<F, IT>;
595 xfunctor_iterator(
const IT&, functor_type*);
597 self_type& operator++();
598 self_type& operator--();
600 self_type& operator+=(difference_type n);
601 self_type& operator-=(difference_type n);
603 difference_type operator-(xfunctor_iterator rhs)
const;
605 reference operator*()
const;
606 pointer operator->()
const;
608 bool equal(
const xfunctor_iterator& rhs)
const;
609 bool less_than(
const xfunctor_iterator& rhs)
const;
614 functor_type* p_functor;
617 template <
class F,
class IT>
620 template <
class F,
class IT>
627 template <
class F,
class ST>
628 class xfunctor_stepper
632 using functor_type = F;
635 using value_type =
typename functor_type::value_type;
636 using reference =
typename proxy_inner::reference;
637 using pointer = std::remove_reference_t<reference>*;
638 using size_type =
typename ST::size_type;
639 using difference_type =
typename ST::difference_type;
641 using shape_type =
typename ST::shape_type;
643 xfunctor_stepper() =
default;
644 xfunctor_stepper(
const ST&, functor_type*);
646 reference operator*()
const;
648 void step(size_type dim);
649 void step_back(size_type dim);
650 void step(size_type dim, size_type n);
651 void step_back(size_type dim, size_type n);
652 void reset(size_type dim);
653 void reset_back(size_type dim);
661 functor_type* p_functor;
681 , m_functor(functor_type())
692 template <
class Func,
class E>
694 : m_e(std::forward<E>(e))
695 , m_functor(std::forward<Func>(func))
729 return m_e.strides();
738 return m_e.backstrides();
751 inline bool xfunctor_applier_base<D>::is_contiguous() const noexcept
753 return m_e.is_contiguous();
769 template <
class... Args>
770 inline auto xfunctor_applier_base<D>::operator()(Args... args) -> reference
772 XTENSOR_TRY(check_index(
shape(), args...));
773 XTENSOR_CHECK_DIMENSION(
shape(), args...);
774 return m_functor(m_e(args...));
797 template <
class... Args>
798 inline auto xfunctor_applier_base<D>::unchecked(Args... args) -> reference
800 return m_functor(m_e.unchecked(args...));
812 inline auto xfunctor_applier_base<D>::element(IT first, IT last) -> reference
814 XTENSOR_TRY(check_element_index(
shape(), first, last));
815 return m_functor(m_e.element(first, last));
825 template <
class... Args>
826 inline auto xfunctor_applier_base<D>::operator()(Args... args)
const -> const_reference
828 XTENSOR_TRY(check_index(
shape(), args...));
829 XTENSOR_CHECK_DIMENSION(
shape(), args...);
830 return m_functor(m_e(args...));
853 template <
class... Args>
854 inline auto xfunctor_applier_base<D>::unchecked(Args... args)
const -> const_reference
856 return m_functor(m_e.unchecked(args...));
868 inline auto xfunctor_applier_base<D>::element(IT first, IT last)
const -> const_reference
870 XTENSOR_TRY(check_element_index(
shape(), first, last));
871 return m_functor(m_e.element(first, last));
908 return m_e.broadcast_shape(
shape, reuse_cache);
921 return m_e.has_linear_assign(
strides);
935 template <layout_type L>
950 template <layout_type L>
961 template <layout_type L>
973 template <layout_type L>
976 return this->
template cend<L>();
984 template <layout_type L>
999 template <layout_type L>
1022 template <
class S, layout_type L>
1025 return broadcast_iterator<S, L>(m_e.template
begin<S, L>(
shape), &m_functor);
1036 template <
class S, layout_type L>
1039 return broadcast_iterator<S, L>(m_e.template
end<S, L>(
shape), &m_functor);
1050 template <
class S, layout_type L>
1052 -> const_broadcast_iterator<S, L>
1065 template <
class S, layout_type L>
1079 template <
class S, layout_type L>
1081 -> const_broadcast_iterator<S, L>
1083 return const_broadcast_iterator<S, L>(m_e.template
cbegin<S, L>(
shape), &m_functor);
1094 template <
class S, layout_type L>
1097 return const_broadcast_iterator<S, L>(m_e.template
cend<S, L>(
shape), &m_functor);
1111 template <layout_type L>
1126 template <layout_type L>
1140 template <layout_type L>
1152 template <layout_type L>
1163 template <layout_type L>
1178 template <layout_type L>
1201 template <
class S, layout_type L>
1204 return reverse_broadcast_iterator<S, L>(m_e.template
rbegin<S, L>(
shape), &m_functor);
1215 template <
class S, layout_type L>
1218 return reverse_broadcast_iterator<S, L>(m_e.template
rend<S, L>(
shape), &m_functor);
1229 template <
class S, layout_type L>
1231 -> const_reverse_broadcast_iterator<S, L>
1244 template <
class S, layout_type L>
1246 -> const_reverse_broadcast_iterator<S, L>
1259 template <
class S, layout_type L>
1261 -> const_reverse_broadcast_iterator<S, L>
1263 return const_reverse_broadcast_iterator<S, L>(m_e.template
crbegin<S, L>(), &m_functor);
1274 template <
class S, layout_type L>
1276 -> const_reverse_broadcast_iterator<S, L>
1278 return const_reverse_broadcast_iterator<S, L>(m_e.template
crend<S, L>(
shape), &m_functor);
1284 inline auto xfunctor_applier_base<D>::linear_begin() noexcept -> linear_iterator
1286 return linear_iterator(m_e.linear_begin(), &m_functor);
1290 inline auto xfunctor_applier_base<D>::linear_end() noexcept -> linear_iterator
1292 return linear_iterator(m_e.linear_end(), &m_functor);
1298 return const_linear_iterator(m_e.linear_begin(), &m_functor);
1304 return const_linear_iterator(m_e.linear_end(), &m_functor);
1310 return const_linear_iterator(m_e.linear_cbegin(), &m_functor);
1316 return const_linear_iterator(m_e.linear_cend(), &m_functor);
1322 return reverse_linear_iterator(m_e.linear_rbegin(), &m_functor);
1328 return reverse_linear_iterator(m_e.linear_rend(), &m_functor);
1334 return const_reverse_linear_iterator(m_e.linear_rbegin(), &m_functor);
1340 return const_reverse_linear_iterator(m_e.linear_rend(), &m_functor);
1346 return const_reverse_linear_iterator(m_e.linear_crbegin(), &m_functor);
1352 return const_reverse_linear_iterator(m_e.linear_crend(), &m_functor);
1363 return stepper(m_e.stepper_begin(
shape), &m_functor);
1370 return stepper(m_e.stepper_end(
shape, l), &m_functor);
1377 const xexpression_type& const_m_e = m_e;
1378 return const_stepper(const_m_e.stepper_begin(
shape), &m_functor);
1386 const xexpression_type& const_m_e = m_e;
1387 return const_stepper(const_m_e.stepper_end(
shape, l), &m_functor);
1401 template <
class F,
class CT>
1406 && std::equal(this->
shape().
begin(), this->
shape().
end(), e.derived_cast().shape().begin());
1409 semantic_base::operator=(
broadcast(e.derived_cast(), this->shape()));
1413 semantic_base::operator=(e);
1420 template <
class F,
class CT>
1422 inline auto xfunctor_view<F, CT>::operator=(
const E& e) -> disable_xexpression<E, self_type>&
1424 std::fill(this->
begin(), this->
end(), e);
1428 template <
class F,
class CT>
1429 inline void xfunctor_view<F, CT>::assign_temporary_impl(temporary_type&& tmp)
1431 std::copy(tmp.cbegin(), tmp.cend(), this->begin());
1434 template <
class F,
class CT>
1436 inline auto xfunctor_view<F, CT>::build_functor_view(E&& e)
const -> rebind_t<E>
1438 return rebind_t<E>((this->m_functor), std::forward<E>(e));
1452 template <
class F,
class CT>
1454 inline auto xfunctor_adaptor<F, CT>::operator=(
const xexpression<E>& e) -> self_type&
1456 const auto& de = e.derived_cast();
1457 this->m_e.resize(de.shape());
1459 if (this->
layout() == de.layout())
1461 std::copy(de.linear_begin(), de.linear_end(), this->linear_begin());
1466 std::copy(de.begin(), de.end(), this->begin());
1474 template <
class F,
class CT>
1476 auto xfunctor_adaptor<F, CT>::resize(S&& shape,
bool force)
1478 this->m_e.resize(std::forward<S>(shape), force);
1481 template <
class F,
class CT>
1485 this->m_e.resize(std::forward<S>(
shape), l);
1488 template <
class F,
class CT>
1490 auto xfunctor_adaptor<F, CT>::resize(S&&
shape,
const strides_type&
strides)
1495 template <
class F,
class CT>
1499 this->m_e.reshape(std::forward<S>(
shape),
layout);
1507 template <
class F,
class IT>
1508 xfunctor_iterator<F, IT>::xfunctor_iterator(
const IT& it, functor_type* pf)
1514 template <
class F,
class IT>
1515 inline auto xfunctor_iterator<F, IT>::operator++() -> self_type&
1521 template <
class F,
class IT>
1522 inline auto xfunctor_iterator<F, IT>::operator--() -> self_type&
1528 template <
class F,
class IT>
1529 inline auto xfunctor_iterator<F, IT>::operator+=(difference_type n) -> self_type&
1535 template <
class F,
class IT>
1536 inline auto xfunctor_iterator<F, IT>::operator-=(difference_type n) -> self_type&
1542 template <
class F,
class IT>
1543 inline auto xfunctor_iterator<F, IT>::operator-(
xfunctor_iterator rhs)
const -> difference_type
1545 return m_it - rhs.m_it;
1548 template <
class F,
class IT>
1549 auto xfunctor_iterator<F, IT>::operator*() const -> reference
1551 return (*p_functor)(*m_it);
1554 template <
class F,
class IT>
1555 auto xfunctor_iterator<F, IT>::operator->() const -> pointer
1560 template <
class F,
class IT>
1561 auto xfunctor_iterator<F, IT>::equal(
const xfunctor_iterator& rhs)
const ->
bool
1563 return m_it == rhs.m_it;
1566 template <
class F,
class IT>
1567 auto xfunctor_iterator<F, IT>::less_than(
const xfunctor_iterator& rhs)
const ->
bool
1569 return m_it < rhs.m_it;
1572 template <
class F,
class IT>
1575 return lhs.equal(rhs);
1578 template <
class F,
class IT>
1581 return !lhs.less_than(rhs);
1588 template <
class F,
class ST>
1589 xfunctor_stepper<F, ST>::xfunctor_stepper(
const ST& stepper, functor_type* pf)
1590 : m_stepper(stepper)
1595 template <
class F,
class ST>
1596 auto xfunctor_stepper<F, ST>::operator*() const -> reference
1598 return (*p_functor)(*m_stepper);
1601 template <
class F,
class ST>
1602 void xfunctor_stepper<F, ST>::step(size_type dim)
1604 m_stepper.step(dim);
1607 template <
class F,
class ST>
1608 void xfunctor_stepper<F, ST>::step_back(size_type dim)
1610 m_stepper.step_back(dim);
1613 template <
class F,
class ST>
1614 void xfunctor_stepper<F, ST>::step(size_type dim, size_type n)
1616 m_stepper.step(dim, n);
1619 template <
class F,
class ST>
1620 void xfunctor_stepper<F, ST>::step_back(size_type dim, size_type n)
1622 m_stepper.step_back(dim, n);
1625 template <
class F,
class ST>
1626 void xfunctor_stepper<F, ST>::reset(size_type dim)
1628 m_stepper.reset(dim);
1631 template <
class F,
class ST>
1632 void xfunctor_stepper<F, ST>::reset_back(size_type dim)
1634 m_stepper.reset_back(dim);
1637 template <
class F,
class ST>
1638 void xfunctor_stepper<F, ST>::to_begin()
1640 m_stepper.to_begin();
1643 template <
class F,
class ST>
1644 void xfunctor_stepper<F, ST>::to_end(
layout_type l)
1646 m_stepper.to_end(l);
Base class for implementation of common expression access methods.
Base class for implementation of common expression constant access methods.
size_type dimension() const noexcept
bool in_bounds(Args... args) const
Base class for xexpressions.
Adapt a container with a functor, forwarding methods such as resize / reshape.
const inner_backstrides_type & backstrides() const noexcept
layout_type layout() const noexcept
xfunctor_applier_base(undecay_expression) noexcept
Constructs an xfunctor_applier_base expression wrappering the specified xt::xexpression.
xexpression_type & expression() noexcept
auto cend() const noexcept
auto cbegin() const noexcept
const inner_shape_type & shape() const noexcept
bool has_linear_assign(const S &strides) const
xfunctor_applier_base(Func &&, E &&) noexcept
Constructs an xfunctor_applier_base expression wrappering the specified xt::xexpression.
auto begin() noexcept
Returns an iterator to the first element of the expression.
bool broadcast_shape(S &shape, bool reuse_cache=false) const
size_type size() const noexcept
auto crend() const noexcept
const inner_strides_type & strides() const noexcept
auto crbegin() const noexcept
auto operator*(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t< detail::multiplies, E1, E2 >
Multiplication.
standard mathematical functions for xexpressions
auto broadcast(E &&e, const S &s)
Returns an xexpression broadcasting the given expression to a specified shape.
xarray_container< uvector< T, A >, L, xt::svector< typename uvector< T, A >::size_type, 4, SA, true > > xarray
Alias template on xarray_container with default parameters for data container type and shape / stride...
bool operator==(const xaxis_iterator< CT > &lhs, const xaxis_iterator< CT > &rhs)
Checks equality of the iterators.