Stratax 0.4.0rc1
Loading...
Searching...
No Matches
Math.hpp File Reference

Element-wise wrappers around standard-library math functions. More...

#include <cmath>
#include <type_traits>
#include <cstddef>
#include <stratax/core/ArrayTraits.hpp>
#include <stratax/core/dtypes/Concepts.hpp>
#include <stratax/core/dtypes/Types.hpp>
#include <stratax/ops/Broadcasting.hpp>
Include dependency graph for Math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stratax::core::math_detail::MathResult< T >
 Maps a non-integral input dtype to the same result dtype. More...
 
struct  stratax::core::math_detail::MathResult< T >
 Maps every supported integral dtype to float64. More...
 
struct  stratax::core::math_detail::PowResult< L, R >
 Determines the common result dtype for a binary math operation. More...
 
struct  stratax::core::math_detail::AbsResult< T >
 Preserves the dtype of a real absolute-value operation. More...
 
struct  stratax::core::math_detail::AbsResult< T >
 Maps a complex dtype to its real component dtype. More...
 

Typedefs

template<typename T >
using stratax::core::math_detail::math_result_t = typename MathResult< std::remove_cvref_t< T > >::type
 Unary math result dtype: float64 for integers, otherwise the input dtype.
 
template<typename L , typename R >
using stratax::core::math_detail::pow_result_t = typename PowResult< L, R >::type
 Binary math result dtype: promoted dtype, with integral results changed to float64.
 
template<typename T >
using stratax::core::math_detail::abs_result_t = typename AbsResult< std::remove_cvref_t< T > >::type
 Absolute-value result dtype, using the real component for complex inputs.
 

Functions

template<Array A, DType Result, typename Op >
auto stratax::core::math_detail::unary_op (const A &arr, Op op)
 Applies a unary callable to every element of an array.
 
template<Array A, typename Op >
auto stratax::core::math_detail::standard_math_op (const A &arr, Op op)
 Applies a unary math callable using the standard result dtype.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sqrt (const A &arr)
 Computes the element-wise principal square root.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cbrt (const A &arr)
 Computes the element-wise real cube root.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::exp (const A &arr)
 Computes e raised to each element.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::exp2 (const A &arr)
 Computes 2 raised to each element.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::expm1 (const A &arr)
 Computes e raised to each element minus one.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log (const A &arr)
 Computes the element-wise natural logarithm.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log2 (const A &arr)
 Computes the element-wise base-2 logarithm.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log10 (const A &arr)
 Computes the element-wise base-10 logarithm.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::log1p (const A &arr)
 Computes the natural logarithm of one plus each element.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::logb (const A &arr)
 Extracts the unbiased floating-point exponent of each element.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sin (const A &arr)
 Computes the element-wise sine in radians.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cos (const A &arr)
 Computes the element-wise cosine in radians.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::tan (const A &arr)
 Computes the element-wise tangent in radians.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::asin (const A &arr)
 Computes the element-wise inverse sine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::acos (const A &arr)
 Computes the element-wise inverse cosine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::atan (const A &arr)
 Computes the element-wise inverse tangent.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sinh (const A &arr)
 Computes the element-wise hyperbolic sine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cosh (const A &arr)
 Computes the element-wise hyperbolic cosine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::tanh (const A &arr)
 Computes the element-wise hyperbolic tangent.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::asinh (const A &arr)
 Computes the element-wise inverse hyperbolic sine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::acosh (const A &arr)
 Computes the element-wise inverse hyperbolic cosine.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::atanh (const A &arr)
 Computes the element-wise inverse hyperbolic tangent.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::erf (const A &arr)
 Computes the element-wise error function.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::erfc (const A &arr)
 Computes the element-wise complementary error function.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::tgamma (const A &arr)
 Computes the element-wise gamma function.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::lgamma (const A &arr)
 Computes the logarithm of the absolute gamma function element-wise.
 
template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::abs (const A &arr)
 Computes the absolute value or complex magnitude of each element.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::floor (const A &arr)
 Rounds each element downward.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::ceil (const A &arr)
 Rounds each element upward.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::trunc (const A &arr)
 Rounds each element toward zero.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::round (const A &arr)
 Rounds each element to the nearest integer value, with halfway cases away from zero.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::nearbyint (const A &arr)
 Rounds each element using the current rounding mode without raising inexact.
 
template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::rint (const A &arr)
 Rounds each element using the current floating-point rounding mode.
 
template<Array L, Array R>
auto stratax::core::pow (const L &lhs, const R &rhs)
 Raises each broadcasted left element to its corresponding right power.
 
template<Array L, Array R>
auto stratax::core::atan2 (const L &lhs, const R &rhs)
 Computes the two-argument arctangent of each broadcasted element pair.
 
template<Array L, Array R>
auto stratax::core::hypot (const L &lhs, const R &rhs)
 Computes element-wise hypotenuses after broadcasting.
 
template<Array L, Array R>
auto stratax::core::fmod (const L &lhs, const R &rhs)
 Computes element-wise floating-point remainders after broadcasting.
 
template<Array L, Array R>
auto stratax::core::remainder (const L &lhs, const R &rhs)
 Computes element-wise IEEE remainders after broadcasting.
 
template<Array L, Array R>
auto stratax::core::copysign (const L &lhs, const R &rhs)
 Copies each broadcasted right sign onto the corresponding left magnitude.
 
template<Array L, Array R>
auto stratax::core::fmax (const L &lhs, const R &rhs)
 Selects the element-wise floating-point maximum after broadcasting.
 
template<Array L, Array R>
auto stratax::core::fmin (const L &lhs, const R &rhs)
 Selects the element-wise floating-point minimum after broadcasting.
 
template<Array L, Array R>
requires ( RealNumeric<typename L::value_type> && RealNumeric<typename R::value_type> )
auto stratax::core::fdim (const L &lhs, const R &rhs)
 Computes the positive difference of each broadcasted element pair.
 
template<Array L, Array R>
requires ( RealNumeric<typename L::value_type> && RealNumeric<typename R::value_type> )
auto stratax::core::nextafter (const L &lhs, const R &rhs)
 Finds the next representable value from each left element toward its broadcasted right element.
 

Detailed Description

Element-wise wrappers around standard-library math functions.

Result traits support owning Vector, Matrix, and Tensor inputs. Unary standard math functions return float64 for integral inputs and preserve other dtypes. Rounding functions preserve the input dtype; abs returns a complex input component dtype. Binary functions use math_detail::pow_result_t: ordinary dtype promotion, with integral results changed to float64.

Values are passed to the underlying std function in their original types, then converted to the result dtype. Its domain, range, NaN, rounding, and floating-point error behavior apply; no Stratax domain checks are added. Every result owns new storage; allocation failures propagate.

Definition in file Math.hpp.

Typedef Documentation

◆ abs_result_t

template<typename T >
using stratax::core::math_detail::abs_result_t = typedef typename AbsResult<std::remove_cvref_t<T> >::type

Absolute-value result dtype, using the real component for complex inputs.

Definition at line 131 of file Math.hpp.

◆ math_result_t

template<typename T >
using stratax::core::math_detail::math_result_t = typedef typename MathResult<std::remove_cvref_t<T> >::type

Unary math result dtype: float64 for integers, otherwise the input dtype.

Definition at line 68 of file Math.hpp.

◆ pow_result_t

template<typename L , typename R >
using stratax::core::math_detail::pow_result_t = typedef typename PowResult<L, R>::type

Binary math result dtype: promoted dtype, with integral results changed to float64.

Definition at line 105 of file Math.hpp.

Function Documentation

◆ abs()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::abs ( const A &  arr)

Computes the absolute value or complex magnitude of each element.

Returns
Shape-preserving array; real input keeps its dtype and complex input returns its component dtype.
Note
Requires an unambiguous scalar abs overload. Unsigned types that do not promote to int are unsupported by the standard overload set.
Complexity
O(arr.size() + arr.rank()).

Definition at line 459 of file Math.hpp.

◆ acos()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::acos ( const A &  arr)

Computes the element-wise inverse cosine.

Returns
Shape-preserving owning array in radians.
Complexity
O(arr.size() + arr.rank()).

Definition at line 309 of file Math.hpp.

◆ acosh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::acosh ( const A &  arr)

Computes the element-wise inverse hyperbolic cosine.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 381 of file Math.hpp.

◆ asin()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::asin ( const A &  arr)

Computes the element-wise inverse sine.

Returns
Shape-preserving owning array in radians.
Complexity
O(arr.size() + arr.rank()).

Definition at line 297 of file Math.hpp.

◆ asinh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::asinh ( const A &  arr)

Computes the element-wise inverse hyperbolic sine.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 369 of file Math.hpp.

◆ atan()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::atan ( const A &  arr)

Computes the element-wise inverse tangent.

Returns
Shape-preserving owning array in radians.
Complexity
O(arr.size() + arr.rank()).

Definition at line 321 of file Math.hpp.

◆ atan2()

template<Array L, Array R>
auto stratax::core::atan2 ( const L &  lhs,
const R &  rhs 
)

Computes the two-argument arctangent of each broadcasted element pair.

Returns
Owning array with the common broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r), where n is result size and r is result rank.

Definition at line 593 of file Math.hpp.

◆ atanh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::atanh ( const A &  arr)

Computes the element-wise inverse hyperbolic tangent.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 393 of file Math.hpp.

◆ cbrt()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cbrt ( const A &  arr)

Computes the element-wise real cube root.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).
Note
Requires a real numeric dtype; the underlying std function has no complex overload.

Definition at line 153 of file Math.hpp.

◆ ceil()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::ceil ( const A &  arr)

Rounds each element upward.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 491 of file Math.hpp.

◆ copysign()

template<Array L, Array R>
auto stratax::core::copysign ( const L &  lhs,
const R &  rhs 
)

Copies each broadcasted right sign onto the corresponding left magnitude.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 665 of file Math.hpp.

◆ cos()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cos ( const A &  arr)

Computes the element-wise cosine in radians.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 273 of file Math.hpp.

◆ cosh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::cosh ( const A &  arr)

Computes the element-wise hyperbolic cosine.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 345 of file Math.hpp.

◆ erf()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::erf ( const A &  arr)

Computes the element-wise error function.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 405 of file Math.hpp.

◆ erfc()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::erfc ( const A &  arr)

Computes the element-wise complementary error function.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 417 of file Math.hpp.

◆ exp()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::exp ( const A &  arr)

Computes e raised to each element.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 165 of file Math.hpp.

◆ exp2()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::exp2 ( const A &  arr)

Computes 2 raised to each element.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).
Note
Requires a real numeric dtype; the underlying std function has no complex overload.

Definition at line 177 of file Math.hpp.

◆ expm1()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::expm1 ( const A &  arr)

Computes e raised to each element minus one.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 189 of file Math.hpp.

◆ fdim()

template<Array L, Array R>
requires ( RealNumeric<typename L::value_type> && RealNumeric<typename R::value_type> )
auto stratax::core::fdim ( const L &  lhs,
const R &  rhs 
)

Computes the positive difference of each broadcasted element pair.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 723 of file Math.hpp.

◆ floor()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::floor ( const A &  arr)

Rounds each element downward.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 476 of file Math.hpp.

◆ fmax()

template<Array L, Array R>
auto stratax::core::fmax ( const L &  lhs,
const R &  rhs 
)

Selects the element-wise floating-point maximum after broadcasting.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 683 of file Math.hpp.

◆ fmin()

template<Array L, Array R>
auto stratax::core::fmin ( const L &  lhs,
const R &  rhs 
)

Selects the element-wise floating-point minimum after broadcasting.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 701 of file Math.hpp.

◆ fmod()

template<Array L, Array R>
auto stratax::core::fmod ( const L &  lhs,
const R &  rhs 
)

Computes element-wise floating-point remainders after broadcasting.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 629 of file Math.hpp.

◆ hypot()

template<Array L, Array R>
auto stratax::core::hypot ( const L &  lhs,
const R &  rhs 
)

Computes element-wise hypotenuses after broadcasting.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 611 of file Math.hpp.

◆ lgamma()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::lgamma ( const A &  arr)

Computes the logarithm of the absolute gamma function element-wise.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 441 of file Math.hpp.

◆ log()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log ( const A &  arr)

Computes the element-wise natural logarithm.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 201 of file Math.hpp.

◆ log10()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log10 ( const A &  arr)

Computes the element-wise base-10 logarithm.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 225 of file Math.hpp.

◆ log1p()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::log1p ( const A &  arr)

Computes the natural logarithm of one plus each element.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 237 of file Math.hpp.

◆ log2()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::log2 ( const A &  arr)

Computes the element-wise base-2 logarithm.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).
Note
Requires a real numeric dtype; the underlying std function has no complex overload.

Definition at line 213 of file Math.hpp.

◆ logb()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::logb ( const A &  arr)

Extracts the unbiased floating-point exponent of each element.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 249 of file Math.hpp.

◆ nearbyint()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::nearbyint ( const A &  arr)

Rounds each element using the current rounding mode without raising inexact.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 536 of file Math.hpp.

◆ nextafter()

template<Array L, Array R>
requires ( RealNumeric<typename L::value_type> && RealNumeric<typename R::value_type> )
auto stratax::core::nextafter ( const L &  lhs,
const R &  rhs 
)

Finds the next representable value from each left element toward its broadcasted right element.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 745 of file Math.hpp.

◆ pow()

template<Array L, Array R>
auto stratax::core::pow ( const L &  lhs,
const R &  rhs 
)

Raises each broadcasted left element to its corresponding right power.

Returns
Owning array with the common broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r), where n is result size and r is result rank.

Definition at line 570 of file Math.hpp.

◆ remainder()

template<Array L, Array R>
auto stratax::core::remainder ( const L &  lhs,
const R &  rhs 
)

Computes element-wise IEEE remainders after broadcasting.

Returns
Owning array with the broadcasted shape and math_detail::pow_result_t dtype.
Exceptions
Exceptions::BroadcastErrorIf shapes are incompatible or an empty operand would supply values to a nonempty result.
Complexity
O((n + 1) * r).

Definition at line 647 of file Math.hpp.

◆ rint()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::rint ( const A &  arr)

Rounds each element using the current floating-point rounding mode.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 551 of file Math.hpp.

◆ round()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::round ( const A &  arr)

Rounds each element to the nearest integer value, with halfway cases away from zero.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 521 of file Math.hpp.

◆ sin()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sin ( const A &  arr)

Computes the element-wise sine in radians.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 261 of file Math.hpp.

◆ sinh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sinh ( const A &  arr)

Computes the element-wise hyperbolic sine.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 333 of file Math.hpp.

◆ sqrt()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::sqrt ( const A &  arr)

Computes the element-wise principal square root.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 141 of file Math.hpp.

◆ standard_math_op()

template<Array A, typename Op >
auto stratax::core::math_detail::standard_math_op ( const A &  arr,
Op  op 
)

Applies a unary math callable using the standard result dtype.

Returns
Owning array with the input container, shape, and inferred dtype.
Invariant
Integral input is promoted to float64; other dtypes are preserved.

Definition at line 78 of file Math.hpp.

◆ tan()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::tan ( const A &  arr)

Computes the element-wise tangent in radians.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 285 of file Math.hpp.

◆ tanh()

template<Array A>
requires Numeric<typename A::value_type>
auto stratax::core::tanh ( const A &  arr)

Computes the element-wise hyperbolic tangent.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 357 of file Math.hpp.

◆ tgamma()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::tgamma ( const A &  arr)

Computes the element-wise gamma function.

Returns
Shape-preserving owning array.
Complexity
O(arr.size() + arr.rank()).

Definition at line 429 of file Math.hpp.

◆ trunc()

template<Array A>
requires RealNumeric<typename A::value_type>
auto stratax::core::trunc ( const A &  arr)

Rounds each element toward zero.

Returns
Shape-preserving array with the input dtype.
Complexity
O(arr.size() + arr.rank()).

Definition at line 506 of file Math.hpp.

◆ unary_op()

template<Array A, DType Result, typename Op >
auto stratax::core::math_detail::unary_op ( const A &  arr,
Op  op 
)

Applies a unary callable to every element of an array.

Returns
Owning array with the input container and requested result dtype.
Invariant
The result preserves the input shape and element order.

Definition at line 35 of file Math.hpp.