xtensor
Loading...
Searching...
No Matches
Power functions

Functions

template<class E1 , class E2 >
auto xt::pow (E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t< math::pow_fun, E1, E2 >
 Power function.
 
template<class E1 >
auto xt::square (E1 &&e1) noexcept
 Square power function, equivalent to e1 * e1.
 
template<class E1 >
auto xt::cube (E1 &&e1) noexcept
 Cube power function, equivalent to e1 * e1 * e1.
 
template<std::size_t N, class E >
auto xt::pow (E &&e) noexcept
 Integer power function.
 
template<class E >
auto xt::sqrt (E &&e) noexcept -> detail::xfunction_type_t< math::sqrt_fun, E >
 Square root function.
 
template<class E >
auto xt::cbrt (E &&e) noexcept -> detail::xfunction_type_t< math::cbrt_fun, E >
 Cubic root function.
 
template<class E1 , class E2 >
auto xt::hypot (E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t< math::hypot_fun, E1, E2 >
 Hypotenuse function.
 

Detailed Description

Function Documentation

◆ cbrt()

template<class E >
auto xt::cbrt ( E && e) -> detail::xfunction_type_t<math::cbrt_fun, E>
inlinenoexcept

Cubic root function.

Returns an xfunction for the element-wise cubic root of e.

Parameters
ean xexpression
Returns
an xfunction

Definition at line 1254 of file xmath.hpp.

◆ cube()

template<class E1 >
auto xt::cube ( E1 && e1)
inlinenoexcept

Cube power function, equivalent to e1 * e1 * e1.

Returns an xfunction for the element-wise value of of e1 * e1.

Parameters
e1an xexpression or a scalar
Returns
an xfunction

Definition at line 1151 of file xmath.hpp.

◆ hypot()

template<class E1 , class E2 >
auto xt::hypot ( E1 && e1,
E2 && e2 ) -> detail::xfunction_type_t<math::hypot_fun, E1, E2>
inlinenoexcept

Hypotenuse function.

Returns an xfunction for the element-wise square root of the sum of the square of e1 and e2, avoiding overflow and underflow at intermediate stages of computation.

Parameters
e1an xexpression or a scalar
e2an xexpression or a scalar
Returns
an xfunction
Note
e1 and e2 can't be both scalars.

Definition at line 1272 of file xmath.hpp.

◆ pow() [1/2]

template<std::size_t N, class E >
auto xt::pow ( E && e)
inlinenoexcept

Integer power function.

Returns an xfunction for the element-wise power of e1 to an integral constant.

Instead of computing the power by using the (expensive) logarithm, this function computes the power in a number of straight-forward multiplication steps. This function is therefore much faster (even for high N) than the generic pow-function.

For example, e1^20 can be expressed as (((e1^2)^2)^2)^2*(e1^2)^2, which is just 5 multiplications.

Parameters
ean xexpression
Template Parameters
Nthe exponent (has to be positive integer)
Returns
an xfunction

Definition at line 1223 of file xmath.hpp.

◆ pow() [2/2]

template<class E1 , class E2 >
auto xt::pow ( E1 && e1,
E2 && e2 ) -> detail::xfunction_type_t<math::pow_fun, E1, E2>
inlinenoexcept

Power function.

Returns an xfunction for the element-wise value of of e1 raised to the power e2.

Parameters
e1an xexpression or a scalar
e2an xexpression or a scalar
Returns
an xfunction
Note
e1 and e2 can't be both scalars.

Definition at line 1015 of file xmath.hpp.

◆ sqrt()

template<class E >
auto xt::sqrt ( E && e) -> detail::xfunction_type_t<math::sqrt_fun, E>
inlinenoexcept

Square root function.

Returns an xfunction for the element-wise square root of e.

Parameters
ean xexpression
Returns
an xfunction

Definition at line 1239 of file xmath.hpp.

◆ square()

template<class E1 >
auto xt::square ( E1 && e1)
inlinenoexcept

Square power function, equivalent to e1 * e1.

Returns an xfunction for the element-wise value of of e1 * e1.

Parameters
e1an xexpression or a scalar
Returns
an xfunction

Definition at line 1128 of file xmath.hpp.