10#ifndef XTENSOR_OPTIONAL_HPP
11#define XTENSOR_OPTIONAL_HPP
16#include <xtl/xoptional.hpp>
17#include <xtl/xoptional_sequence.hpp>
19#include "../containers/xarray.hpp"
20#include "../containers/xscalar.hpp"
21#include "../containers/xtensor.hpp"
22#include "../generators/xgenerator.hpp"
23#include "../reducers/xreducer.hpp"
24#include "../views/xbroadcast.hpp"
25#include "../views/xdynamic_view.hpp"
26#include "../views/xfunctor_view.hpp"
27#include "../views/xindex_view.hpp"
28#include "../views/xrepeat.hpp"
29#include "../views/xstrided_view.hpp"
30#include "../views/xview.hpp"
46 template <
class T,
class B>
65 D& derived_cast()
noexcept;
66 const D& derived_cast()
const noexcept;
76 template <
class T,
class Tag>
77 struct split_optional_expression_impl
79 using value_expression = T;
80 using flag_expression =
decltype(
ones<bool>(std::declval<T>().shape()));
83 inline static U&& value(U&&
arg)
85 return std::forward<U>(
arg);
89 inline static flag_expression has_value(U&&
arg)
95 template <
class T,
class Tag>
96 struct split_optional_expression_impl<xscalar<T>, Tag>
98 using value_expression = xscalar<T>;
99 using flag_expression = xscalar<bool>;
102 inline static U&& value(U&&
arg)
104 return std::forward<U>(
arg);
108 inline static flag_expression has_value(U&&)
110 return xscalar<bool>(
true);
115 struct split_optional_expression_impl_base
117 static constexpr bool is_const = std::is_const<std::remove_reference_t<T>>::value;
118 using decay_type = std::decay_t<T>;
120 using value_expression = std::conditional_t<
122 typename decay_type::const_value_expression,
123 typename decay_type::value_expression>;
124 using flag_expression = std::
125 conditional_t<is_const, typename decay_type::const_flag_expression, typename decay_type::flag_expression>;
128 inline static value_expression value(U&&
arg)
134 inline static flag_expression has_value(U&&
arg)
136 return arg.has_value();
141 struct split_optional_expression_impl<T, xoptional_expression_tag>
142 : split_optional_expression_impl_base<T>
147 struct split_optional_expression_impl<xscalar<T>, xoptional_expression_tag>
148 : split_optional_expression_impl_base<xscalar<T>>
153 struct split_optional_expression
154 : split_optional_expression_impl<T, xexpression_tag_t<std::decay_t<T>>>
159 using value_expression_t =
typename split_optional_expression<T>::value_expression;
162 using flag_expression_t =
typename split_optional_expression<T>::flag_expression;
168 template <
class T =
bool>
169 class optional_bitwise
173 using return_type = T;
174 using first_argument_type = T;
175 using second_argument_type = T;
176 using result_type = T;
177 using simd_value_type = bool;
178 using simd_result_type = bool;
180 template <
class... Args>
181 constexpr result_type operator()(
const Args&... args)
const
183 return apply_impl(args...);
186 template <
class B,
class... Args>
187 constexpr B simd_apply(
const B& b,
const Args&... args)
const
189 return simd_apply_impl(b, args...);
194 constexpr result_type apply_impl()
const
199 template <
class U,
class... Args>
200 constexpr result_type apply_impl(
const U& t,
const Args&... args)
const
202 return t && apply_impl(args...);
206 constexpr B simd_apply_impl(
const B& b)
const
211 template <
class B1,
class B2,
class... Args>
212 constexpr B1 simd_apply_impl(
const B1& b1,
const B2& b2,
const Args&... args)
const
214 return b1 & simd_apply_impl(b2, args...);
222 template <
class T,
class B>
223 struct const_value_rebinder<xtl::xoptional<T, B>, T>
225 static const_value<T> run(
const const_value<xtl::xoptional<T, B>>& src)
227 return const_value<T>(src.m_value.value());
235 template <
class T,
class B>
236 struct xreducer_size_type<xtl::xoptional<T, B>>
238 using type = xtl::xoptional<std::size_t, bool>;
241 template <
class T,
class B>
242 struct xreducer_temporary_type<xtl::xoptional<T, B>>
244 using type = xtl::xoptional<std::decay_t<T>,
bool>;
252 template <
class T,
class B>
253 auto sign(
const xtl::xoptional<T, B>& e);
266 template <
class E1,
class E2,
class P>
279 using closure_type = CT;
280 static constexpr bool is_ref = std::is_reference<closure_type>::value;
281 using unref_closure_type = std::remove_reference_t<closure_type>;
282 static constexpr bool is_const = std::is_const<unref_closure_type>::value;
283 using raw_closure_type = std::decay_t<CT>;
285 using raw_value_closure =
typename raw_closure_type::value_closure;
286 using raw_flag_closure =
typename raw_closure_type::flag_closure;
287 using const_raw_value_closure = std::add_const_t<raw_value_closure>;
288 using const_raw_flag_closure = std::add_const_t<raw_flag_closure>;
290 using value_closure = std::conditional_t<is_ref, std::add_lvalue_reference_t<raw_value_closure>, raw_value_closure>;
291 using flag_closure = std::conditional_t<is_ref, std::add_lvalue_reference_t<raw_flag_closure>, raw_flag_closure>;
292 using const_value_closure = std::
293 conditional_t<is_ref, std::add_lvalue_reference_t<const_raw_value_closure>, raw_value_closure>;
294 using const_flag_closure = std::
295 conditional_t<is_ref, std::add_lvalue_reference_t<const_raw_flag_closure>, raw_flag_closure>;
309 using value_expression =
typename traits::value_expression;
310 using flag_expression =
typename traits::flag_expression;
311 using const_value_expression =
typename traits::const_value_expression;
312 using const_flag_expression =
typename traits::const_flag_expression;
315 value_expression value();
316 const_value_expression value()
const;
318 flag_expression has_value();
319 const_flag_expression has_value()
const;
341 using value_expression =
typename traits::value_expression;
342 using flag_expression =
typename traits::flag_expression;
343 using const_value_expression =
typename traits::const_value_expression;
344 using const_flag_expression =
typename traits::const_flag_expression;
347 value_expression value();
348 const_value_expression value()
const;
350 flag_expression has_value();
351 const_flag_expression has_value()
const;
361 template <
class EC, layout_type L,
class SC>
364 using value_container =
typename std::remove_reference_t<EC>::base_container_type;
365 using flag_container =
typename std::remove_reference_t<EC>::flag_container_type;
372 template <
class EC, layout_type L,
class SC>
378 template <
class EC, layout_type L,
class SC>
392 template <
class EC, layout_type L,
class SC>
398 template <
class EC, layout_type L,
class SC>
412 template <
class EC, std::
size_t N, layout_type L>
415 using value_container =
typename std::remove_reference_t<EC>::base_container_type;
416 using flag_container =
typename std::remove_reference_t<EC>::flag_container_type;
423 template <
class EC, std::
size_t N, layout_type L>
429 template <
class EC, std::
size_t N, layout_type L>
443 template <
class EC, std::
size_t N, layout_type L>
449 template <
class EC, std::
size_t N, layout_type L>
463 template <
class EC, std::
size_t N, layout_type L>
469 template <
class EC, std::
size_t N, layout_type L>
483 template <
class F,
class... CT>
489 using value_functor = F;
490 using flag_functor = xt::detail::optional_bitwise<bool>;
494 using const_value_expression = value_expression;
495 using const_flag_expression = flag_expression;
497 const_value_expression value()
const;
498 const_flag_expression has_value()
const;
502 template <std::size_t... I>
503 const_value_expression value_impl(std::index_sequence<I...>)
const;
505 template <std::size_t... I>
506 const_flag_expression has_value_impl(std::index_sequence<I...>)
const;
509 template <
class F,
class... CT>
522 template <
class CT,
class S, layout_type L,
class FST>
528 using uvt =
typename std::decay_t<CT>::value_expression;
529 using uft =
typename std::decay_t<CT>::flag_expression;
530 using ucvt =
typename std::decay_t<CT>::const_value_expression;
531 using ucft =
typename std::decay_t<CT>::const_flag_expression;
537 value_expression value();
538 const_value_expression value()
const;
540 flag_expression has_value();
541 const_flag_expression has_value()
const;
544 template <
class CT,
class S, layout_type L,
class FST>
557 template <
class CT,
class X>
565 using const_value_expression = value_expression;
566 using const_flag_expression = flag_expression;
568 const_value_expression value()
const;
569 const_flag_expression has_value()
const;
572 template <
class CT,
class X>
585 template <
class F,
class CT>
591 using uvt =
typename std::decay_t<CT>::value_expression;
592 using uft =
typename std::decay_t<CT>::flag_expression;
593 using ucvt =
typename std::decay_t<CT>::const_value_expression;
594 using ucft =
typename std::decay_t<CT>::const_flag_expression;
596 using flag_expression = uft;
598 using const_flag_expression = ucft;
600 value_expression value();
601 const_value_expression value()
const;
603 flag_expression has_value();
604 const_flag_expression has_value()
const;
607 template <
class F,
class CT>
620 template <
class CT,
class I>
626 using uvt =
typename std::decay_t<CT>::value_expression;
627 using ucvt =
typename std::decay_t<CT>::const_value_expression;
628 using uft =
typename std::decay_t<CT>::flag_expression;
629 using ucft =
typename std::decay_t<CT>::const_flag_expression;
635 value_expression value();
636 const_value_expression value()
const;
638 flag_expression has_value();
639 const_flag_expression has_value()
const;
642 template <
class CT,
class I>
655 template <
class F,
class CT,
class X,
class O>
661 using result_type =
typename F::init_value_type;
663 using rebound_result_type =
typename result_type::value_type;
664 using rebound_functors_type =
typename F::template rebind_t<rebound_result_type>;
665 using rebound_reduce_options_values =
typename O::template rebind_t<rebound_result_type>;
666 using rebound_reduce_options_flag =
typename O::template rebind_t<bool>;
672 using const_value_expression = value_expression;
673 using const_flag_expression = flag_expression;
675 const_value_expression value()
const;
676 const_flag_expression has_value()
const;
679 template <
class F,
class CT,
class X,
class O>
692 template <
class CT,
class X>
700 using const_value_expression = value_expression;
701 using const_flag_expression = flag_expression;
703 const_value_expression value()
const;
704 const_flag_expression has_value()
const;
707 template <
class CT,
class X>
720 template <
class CT,
class S, layout_type L,
class FST>
726 using uvt =
typename std::decay_t<CT>::value_expression;
727 using uft =
typename std::decay_t<CT>::flag_expression;
728 using ucvt =
typename std::decay_t<CT>::const_value_expression;
729 using ucft =
typename std::decay_t<CT>::const_flag_expression;
735 value_expression value();
736 const_value_expression value()
const;
738 flag_expression has_value();
739 const_flag_expression has_value()
const;
742 template <
class CT,
class S, layout_type L,
class FST>
755 template <
class CT,
class... S>
761 using uvt =
typename std::decay_t<CT>::value_expression;
762 using uft =
typename std::decay_t<CT>::flag_expression;
763 using ucvt =
typename std::decay_t<CT>::const_value_expression;
764 using ucft =
typename std::decay_t<CT>::const_flag_expression;
765 using value_expression =
xview<uvt, S...>;
766 using flag_expression =
xview<uft, S...>;
767 using const_value_expression =
xview<ucvt, S...>;
768 using const_flag_expression =
xview<ucft, S...>;
770 value_expression value();
771 const_value_expression value()
const;
773 flag_expression has_value();
774 const_flag_expression has_value()
const;
777 template <
class CT,
class... S>
792 template <
class F,
class =
void_t<
int>>
797 static type get(
const F& f)
804 struct value_functor<F, void_t<typename F::value_functor_type>>
806 using type =
typename F::value_functor_type;
808 static type get(
const F& f)
810 return f.value_functor();
815 using value_functor_t =
typename value_functor<F>::type;
819 template <
class... T>
820 bool operator()(T...)
const
826 template <
class F,
class =
void_t<
int>>
829 using type = always_true;
831 static type get(
const F&)
838 struct flag_functor<F, void_t<typename F::flag_functor_type>>
840 using type =
typename F::flag_functor_type;
842 static type get(
const F& f)
844 return f.flag_functor();
849 using flag_functor_t =
typename flag_functor<F>::type;
852 template <
class F,
class R,
class S>
858 using value_closure =
typename R::value_closure;
859 using flag_closure =
typename R::flag_closure;
860 using value_functor = detail::value_functor_t<F>;
861 using flag_functor = detail::flag_functor_t<F>;
864 using const_value_expression = value_expression;
865 using const_flag_expression = flag_expression;
867 const_value_expression value()
const;
868 const_flag_expression has_value()
const;
871 template <
class F,
class R,
class S>
885 inline D& xoptional_empty_base<D>::derived_cast() noexcept
887 return *
static_cast<D*
>(
this);
891 inline const D& xoptional_empty_base<D>::derived_cast() const noexcept
893 return *
static_cast<const D*
>(
this);
904 inline auto xscalar_optional_base<CT>::value() -> value_expression
906 return this->derived_cast().expression().value();
910 inline auto xscalar_optional_base<CT>::value() const -> const_value_expression
912 return this->derived_cast().expression().value();
916 inline auto xscalar_optional_base<CT>::has_value() -> flag_expression
918 return this->derived_cast().expression().has_value();
922 inline auto xscalar_optional_base<CT>::has_value() const -> const_flag_expression
924 return this->derived_cast().expression().has_value();
935 inline auto xcontainer_optional_base<T>::value() -> value_expression
937 return value_expression(this->derived_cast().storage().value(), this->derived_cast().shape());
941 inline auto xcontainer_optional_base<T>::value() const -> const_value_expression
943 return const_value_expression(this->derived_cast().storage().value(), this->derived_cast().shape());
947 inline auto xcontainer_optional_base<T>::has_value() -> flag_expression
949 return flag_expression(this->derived_cast().storage().has_value(), this->derived_cast().shape());
953 inline auto xcontainer_optional_base<T>::has_value() const -> const_flag_expression
955 return const_flag_expression(this->derived_cast().storage().has_value(), this->derived_cast().shape());
965 template <
class F,
class... CT>
966 inline auto xfunction_optional_base<F, CT...>::value() const -> const_value_expression
968 return value_impl(std::make_index_sequence<
sizeof...(CT)>());
971 template <
class F,
class... CT>
972 inline auto xfunction_optional_base<F, CT...>::has_value() const -> const_flag_expression
974 return has_value_impl(std::make_index_sequence<
sizeof...(CT)>());
977 template <
class F,
class... CT>
978 template <std::size_t... I>
979 inline auto xfunction_optional_base<F, CT...>::value_impl(std::index_sequence<I...>)
const
980 -> const_value_expression
982 return value_expression(
984 xt::detail::split_optional_expression<CT>::value(std::get<I>(this->derived_cast().arguments()))...
988 template <
class F,
class... CT>
989 template <std::size_t... I>
990 inline auto xfunction_optional_base<F, CT...>::has_value_impl(std::index_sequence<I...>)
const
991 -> const_flag_expression
993 return flag_expression(
995 xt::detail::split_optional_expression<CT>::has_value(
996 std::get<I>(this->derived_cast().arguments())
1008 template <
class CT,
class S, layout_type L,
class FST>
1009 inline auto xdynamic_view_optional<CT, S, L, FST>::value() -> value_expression
1011 return this->derived_cast().build_view(this->derived_cast().expression().value());
1014 template <
class CT,
class S, layout_type L,
class FST>
1015 inline auto xdynamic_view_optional<CT, S, L, FST>::value() const -> const_value_expression
1017 return this->derived_cast().build_view(this->derived_cast().expression().value());
1020 template <
class CT,
class S, layout_type L,
class FST>
1021 inline auto xdynamic_view_optional<CT, S, L, FST>::has_value() -> flag_expression
1023 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1026 template <
class CT,
class S, layout_type L,
class FST>
1027 inline auto xdynamic_view_optional<CT, S, L, FST>::has_value() const -> const_flag_expression
1029 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1039 template <
class CT,
class X>
1040 inline auto xbroadcast_optional<CT, X>::value() const -> const_value_expression
1042 return this->derived_cast().build_broadcast(this->derived_cast().expression().value());
1045 template <
class CT,
class X>
1046 inline auto xbroadcast_optional<CT, X>::has_value() const -> const_flag_expression
1048 return this->derived_cast().build_broadcast(this->derived_cast().expression().has_value());
1058 template <
class F,
class CT>
1059 inline auto xfunctor_view_optional<F, CT>::value() -> value_expression
1061 return this->derived_cast().build_functor_view(this->derived_cast().expression().value());
1064 template <
class F,
class CT>
1065 inline auto xfunctor_view_optional<F, CT>::value() const -> const_value_expression
1067 return this->derived_cast().build_functor_view(this->derived_cast().expression().value());
1070 template <
class F,
class CT>
1071 inline auto xfunctor_view_optional<F, CT>::has_value() -> flag_expression
1073 return this->derived_cast().expression().has_value();
1076 template <
class F,
class CT>
1077 inline auto xfunctor_view_optional<F, CT>::has_value() const -> const_flag_expression
1079 return this->derived_cast().expression().has_value();
1089 template <
class CT,
class I>
1090 inline auto xindex_view_optional<CT, I>::value() -> value_expression
1092 return this->derived_cast().build_index_view(this->derived_cast().expression().value());
1095 template <
class CT,
class I>
1096 inline auto xindex_view_optional<CT, I>::value() const -> const_value_expression
1098 return this->derived_cast().build_index_view(this->derived_cast().expression().value());
1101 template <
class CT,
class I>
1102 inline auto xindex_view_optional<CT, I>::has_value() -> flag_expression
1104 return this->derived_cast().build_index_view(this->derived_cast().expression().has_value());
1107 template <
class CT,
class I>
1108 inline auto xindex_view_optional<CT, I>::has_value() const -> const_flag_expression
1110 return this->derived_cast().build_index_view(this->derived_cast().expression().has_value());
1120 template <
class F,
class CT,
class X,
class O>
1121 inline auto xreducer_optional<F, CT, X, O>::value() const -> const_value_expression
1123 auto func = this->derived_cast().functors();
1124 auto opts = this->derived_cast().options().template rebind<rebound_result_type>(
1125 this->derived_cast().options().initial_value.value(),
1126 this->derived_cast().options()
1129 return this->derived_cast().build_reducer(
1130 this->derived_cast().expression().value(),
1131 func.template rebind<rebound_result_type>(),
1136 template <
class F,
class CT,
class X,
class O>
1137 inline auto xreducer_optional<F, CT, X, O>::has_value() const -> const_flag_expression
1139 auto opts = this->derived_cast().options().rebind(
1140 this->derived_cast().options().initial_value.has_value(),
1141 this->derived_cast().options()
1144 return this->derived_cast().build_reducer(
1145 this->derived_cast().expression().has_value(),
1146 make_xreducer_functor(xt::detail::optional_bitwise<bool>(), xt::const_value<bool>(
true)),
1158 template <
class CT,
class S, layout_type L,
class FST>
1159 inline auto xstrided_view_optional<CT, S, L, FST>::value() -> value_expression
1161 return this->derived_cast().build_view(this->derived_cast().expression().value());
1164 template <
class CT,
class S, layout_type L,
class FST>
1165 inline auto xstrided_view_optional<CT, S, L, FST>::value() const -> const_value_expression
1167 return this->derived_cast().build_view(this->derived_cast().expression().value());
1170 template <
class CT,
class S, layout_type L,
class FST>
1171 inline auto xstrided_view_optional<CT, S, L, FST>::has_value() -> flag_expression
1173 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1176 template <
class CT,
class S, layout_type L,
class FST>
1177 inline auto xstrided_view_optional<CT, S, L, FST>::has_value() const -> const_flag_expression
1179 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1189 template <
class CT,
class... S>
1190 inline auto xview_optional<CT, S...>::value() -> value_expression
1192 return this->derived_cast().build_view(this->derived_cast().expression().value());
1195 template <
class CT,
class... S>
1196 inline auto xview_optional<CT, S...>::value() const -> const_value_expression
1198 return this->derived_cast().build_view(this->derived_cast().expression().value());
1201 template <
class CT,
class... S>
1202 inline auto xview_optional<CT, S...>::has_value() -> flag_expression
1204 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1207 template <
class CT,
class... S>
1208 inline auto xview_optional<CT, S...>::has_value() const -> const_flag_expression
1210 return this->derived_cast().build_view(this->derived_cast().expression().has_value());
1220 template <
class F,
class R,
class S>
1221 inline auto xgenerator_optional<F, R, S>::value() const -> const_value_expression
1223 return this->derived_cast().template build_generator<value_closure>(
1224 detail::value_functor<F>::get(this->derived_cast().functor())
1228 template <
class F,
class R,
class S>
1229 inline auto xgenerator_optional<F, R, S>::has_value() const -> const_flag_expression
1231 return this->derived_cast().template build_generator<flag_closure>(
1232 detail::flag_functor<F>::get(this->derived_cast().functor())
1243 template <
class T,
class B>
1246 static constexpr auto run(
const xtl::xoptional<T, B>& x)
1253 template <
class T,
class B>
1254 inline auto sign(
const xtl::xoptional<T, B>& e)
1256 using value_type = std::decay_t<T>;
1257 return e.has_value() ? math::sign_impl<value_type>::run(e.value()) : xtl::missing<value_type>();
1264 template <
class E, XTL_REQUIRES(is_xexpression<E>)>
1265 inline auto value(E&& e) -> detail::value_expression_t<E>
1267 return detail::split_optional_expression<E>::value(std::forward<E>(e));
1270 template <
class E, XTL_REQUIRES(is_xexpression<E>)>
1271 inline auto has_value(E&& e) -> detail::flag_expression_t<E>
1273 return detail::split_optional_expression<E>::has_value(std::forward<E>(e));
1278 template <
class T1,
class T2>
1279 struct assign_data_impl
1281 template <
class E1,
class E2,
class P>
1282 static void run(xexpression<E1>& e1,
const xexpression<E2>& e2,
bool trivial, P p)
1284 E1& de1 = e1.derived_cast();
1285 const E2& de2 = e2.derived_cast();
1287 decltype(
auto) bde1 = xt::value(de1);
1288 decltype(
auto) hde1 = xt::has_value(de1);
1289 xexpression_assigner_base<xtensor_expression_tag>::assign_data(bde1, xt::value(de2), trivial, p);
1290 xexpression_assigner_base<xtensor_expression_tag>::assign_data(hde1, xt::has_value(de2), trivial, p);
1295 struct xarray_assigner
1297 template <
class E1,
class E2,
class P>
1298 static void assign(xexpression<E1>& e1,
const xexpression<E2>& e2,
bool trivial, P p)
1300 E1& de1 = e1.derived_cast();
1301 const E2& de2 = e2.derived_cast();
1304 decltype(
auto) bde1 = xt::value(de1);
1305 decltype(
auto) hde1 = xt::has_value(de1);
1306 xexpression_assigner_base<xtensor_expression_tag>::assign_data(bde1, e2, trivial, p);
1307 xexpression_assigner_base<xtensor_expression_tag>::assign_data(hde1, mask, trivial, p);
1312 struct xarray_assigner<xtl::xoptional<T>>
1314 template <
class E1,
class E2,
class P>
1315 static void assign(xexpression<E1>& e1,
const xexpression<E2>& e2,
bool trivial, P p)
1317 xexpression_assigner_base<xtensor_expression_tag>::assign_data(e1, e2, trivial, p);
1322 struct assign_data_impl<xoptional_expression_tag, xtensor_expression_tag>
1324 template <
class E1,
class E2,
class P>
1325 static void run(xexpression<E1>& e1,
const xexpression<E2>& e2,
bool trivial, P p)
1327 xarray_assigner<typename E2::value_type>::assign(e1, e2, trivial, p);
1332 struct assign_data_impl<xtensor_expression_tag, xoptional_expression_tag>
1334 template <
class E1,
class E2,
class P>
1335 static void run(xexpression<E1>& e1,
const xexpression<E2>& e2,
bool trivial, P p)
1337 xexpression_assigner_base<xtensor_expression_tag>::assign_data(e1, e2, trivial, p);
1342 template <
class E1,
class E2,
class P>
1350 detail::assign_data_impl<typename E1::expression_tag, typename E2::expression_tag>::run(e1, e2, trivial, p);
Dense multidimensional container adaptor with tensor semantic.
Dense multidimensional container with tensor semantic.
Broadcasted xexpression to a specified shape.
Base class for xexpressions.
Multidimensional function operating on xtensor expressions.
Multidimensional function operating on indices.
View of an xexpression from vector of indices.
Reducing function operating over specified axes.
View of an xexpression using strides.
Dense multidimensional container adaptor with tensor semantics and fixed dimension.
Dense multidimensional container with tensor semantic and fixed dimension.
Dense multidimensional container adaptor with view semantics and fixed dimension.
Multidimensional view with tensor semantic.
auto sign(E &&e) noexcept -> detail::xfunction_type_t< math::sign_fun, E >
Returns an element-wise indication of the sign of a number.
auto arg(E &&e) noexcept
Calculates the phase angle (in radians) elementwise for the complex numbers in e.
standard mathematical functions for xexpressions
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...
auto ones(S shape) noexcept
Returns an xexpression containing ones of the specified shape.
auto full_like(const xexpression< E > &e, typename E::value_type fill_value)
Create a xcontainer (xarray, xtensor or xtensor_fixed), filled with fill_value and of the same shape,...