xtensor
Loading...
Searching...
No Matches
Xt_xeval

Functions

template<class T >
auto xt::eval (T &&t) -> std::enable_if_t< detail::is_container< std::decay_t< T > >::value, T && >
 Force evaluation of xexpression.
 
template<layout_type L = layout_type::any, class E >
auto xt::as_strided (E &&e) -> std::enable_if_t< has_data_interface< std::decay_t< E > >::value &&detail::has_same_layout< L, E >(), E && >
 Force evaluation of xexpression not providing a data interface and convert to the required layout.
 

Detailed Description

Evaluation functions. Defined in xtensor/xeval.hpp

Function Documentation

◆ as_strided()

template<layout_type L = layout_type::any, class E >
auto xt::as_strided ( E && e) -> std::enable_if_t<has_data_interface<std::decay_t<E>>::value && detail::has_same_layout<L, E>(), E&&>
inline

Force evaluation of xexpression not providing a data interface and convert to the required layout.

// take reference to a (no copy!)
auto&& b = xt::as_strided(a);
// xarray<double> with the required layout
// xexpression
auto&& a_cast = xt::cast<int>(a);
// xarray<int>, not an xexpression
auto&& d = xt::as_strided(a_cast);
// xarray<int> with the required layout
auto as_strided(E &&e) -> std::enable_if_t< has_data_interface< std::decay_t< E > >::value &&detail::has_same_layout< L, E >(), E && >
Force evaluation of xexpression not providing a data interface and convert to the required layout.
Definition xeval.hpp:149
Warning
This function should be used in a local context only. Returning the value returned by this function could lead to a dangling reference.
Returns
The expression when it already provides a data interface with the correct layout, an evaluated xt::xarray or xt::xtensor depending on shape type otherwise.

Definition at line 149 of file xeval.hpp.

◆ eval()

template<class T >
auto xt::eval ( T && t) -> std::enable_if_t<detail::is_container<std::decay_t<T>>::value, T&&>
inline

Force evaluation of xexpression.

xt::xarray<double> a = {1, 2, 3, 4};
auto&& b = xt::eval(a); // b is a reference to a, no copy!
auto&& c = xt::eval(a + b); // c is xarray<double>, not an xexpression
auto eval(T &&t) -> std::enable_if_t< detail::is_container< std::decay_t< T > >::value, T && >
Force evaluation of xexpression.
Definition xeval.hpp:46
Returns
xt::xarray or xt::xtensor depending on shape type

Definition at line 46 of file xeval.hpp.