|
Stratax 0.4.0rc1
|
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>

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. | |
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.
| using stratax::core::math_detail::abs_result_t = typedef typename AbsResult<std::remove_cvref_t<T> >::type |
| using stratax::core::math_detail::math_result_t = typedef typename MathResult<std::remove_cvref_t<T> >::type |
| using stratax::core::math_detail::pow_result_t = typedef typename PowResult<L, R>::type |
Computes the absolute value or complex magnitude of each element.
| auto stratax::core::acos | ( | const A & | arr | ) |
| auto stratax::core::acosh | ( | const A & | arr | ) |
| auto stratax::core::asin | ( | const A & | arr | ) |
| auto stratax::core::asinh | ( | const A & | arr | ) |
| auto stratax::core::atan | ( | const A & | arr | ) |
Computes the two-argument arctangent of each broadcasted element pair.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
n is result size and r is result rank. | auto stratax::core::atanh | ( | const A & | arr | ) |
| auto stratax::core::cbrt | ( | const A & | arr | ) |
| auto stratax::core::ceil | ( | const A & | arr | ) |
Copies each broadcasted right sign onto the corresponding left magnitude.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| auto stratax::core::cosh | ( | const A & | arr | ) |
| auto stratax::core::erf | ( | const A & | arr | ) |
| auto stratax::core::erfc | ( | const A & | arr | ) |
| auto stratax::core::exp2 | ( | const A & | arr | ) |
| auto stratax::core::expm1 | ( | const A & | arr | ) |
| auto stratax::core::fdim | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Computes the positive difference of each broadcasted element pair.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| auto stratax::core::floor | ( | const A & | arr | ) |
Selects the element-wise floating-point maximum after broadcasting.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Selects the element-wise floating-point minimum after broadcasting.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Computes element-wise floating-point remainders after broadcasting.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Computes element-wise hypotenuses after broadcasting.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| auto stratax::core::lgamma | ( | const A & | arr | ) |
| auto stratax::core::log10 | ( | const A & | arr | ) |
| auto stratax::core::log1p | ( | const A & | arr | ) |
| auto stratax::core::log2 | ( | const A & | arr | ) |
| auto stratax::core::logb | ( | const A & | arr | ) |
| auto stratax::core::nearbyint | ( | const A & | arr | ) |
| auto stratax::core::nextafter | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Finds the next representable value from each left element toward its broadcasted right element.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Raises each broadcasted left element to its corresponding right power.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
n is result size and r is result rank. Computes element-wise IEEE remainders after broadcasting.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| auto stratax::core::rint | ( | const A & | arr | ) |
| auto stratax::core::round | ( | const A & | arr | ) |
| auto stratax::core::sinh | ( | const A & | arr | ) |
| auto stratax::core::sqrt | ( | const A & | arr | ) |
| auto stratax::core::math_detail::standard_math_op | ( | const A & | arr, |
| Op | op | ||
| ) |
| auto stratax::core::tanh | ( | const A & | arr | ) |
| auto stratax::core::tgamma | ( | const A & | arr | ) |
| auto stratax::core::trunc | ( | const A & | arr | ) |
| auto stratax::core::math_detail::unary_op | ( | const A & | arr, |
| Op | op | ||
| ) |