|
Uni20
Asynchronous tensor and runtime library.
|
Shared scalar math with native overloads and class-specific ADL customization. More...
Functions | |
| template<class T > requires requires(T const& value) { math::abs(value) * math::abs(value); } | |
| auto | abs_squared (T const &value) |
| Square the magnitude, evaluating the scalar absolute value once. | |
Variables | |
| constexpr detail::scalar_math::abs_fn | abs {} |
| Absolute value or complex magnitude, preserving the selected scalar implementation. | |
| constexpr detail::scalar_math::acos_fn | acos {} |
| Inverse cosine in radians. | |
| constexpr detail::scalar_math::acosh_fn | acosh {} |
| Inverse hyperbolic cosine. | |
| constexpr detail::scalar_math::acospi_fn | acospi {} |
| Principal arccosine divided by pi. | |
| constexpr detail::scalar_math::agm_fn | agm {} |
| Nonnegative arithmetic-geometric mean. | |
| constexpr detail::scalar_math::airy_ai_fn | airy_ai {} |
| Real Airy Ai; native inputs retain their precision and full negative-axis phase. | |
| constexpr detail::scalar_math::asin_fn | asin {} |
| Inverse sine in radians. | |
| constexpr detail::scalar_math::asinh_fn | asinh {} |
| Inverse hyperbolic sine. | |
| constexpr detail::scalar_math::asinpi_fn | asinpi {} |
| Principal arcsine divided by pi. | |
| constexpr detail::scalar_math::atan_fn | atan {} |
| Inverse tangent in radians. | |
| constexpr detail::scalar_math::atan2_fn | atan2 {} |
| Quadrant-aware inverse tangent of y/x in radians. | |
| constexpr detail::scalar_math::atan2pi_fn | atan2pi {} |
| Quadrant-aware arctangent divided by pi. | |
| constexpr detail::scalar_math::atanh_fn | atanh {} |
| Inverse hyperbolic tangent. | |
| constexpr detail::scalar_math::atanpi_fn | atanpi {} |
| Principal arctangent divided by pi. | |
| constexpr detail::scalar_math::bessel_j_fn | bessel_j {} |
| Integer-order Bessel function of the first kind, with order first. | |
| constexpr detail::scalar_math::bessel_y_fn | bessel_y {} |
| Integer-order Bessel function of the second kind, with order first. | |
| constexpr detail::scalar_math::beta_fn | beta {} |
| Real Beta function. | |
| constexpr detail::scalar_math::cbrt_fn | cbrt {} |
| Real cube root, including negative arguments. | |
| constexpr detail::scalar_math::ceil_fn | ceil {} |
| Least integral value not less than the argument, in the scalar's result type. | |
| constexpr detail::scalar_math::compound_fn | compound {} |
| Integer power of one plus x, retaining the original increment. | |
| constexpr detail::scalar_math::conj_fn | conj {} |
| Complex conjugation; real and integral values retain their type. | |
| constexpr detail::scalar_math::copysign_fn | copysign {} |
| Copy the sign while retaining the magnitude operand type and precision. | |
| constexpr detail::scalar_math::cos_fn | cos {} |
| Cosine with scalar-specific precision handling. | |
| constexpr detail::scalar_math::cosh_fn | cosh {} |
| Hyperbolic cosine. | |
| constexpr detail::scalar_math::cospi_fn | cospi {} |
| Cosine of pi times x, with argument reduction before multiplication by pi. | |
| constexpr detail::scalar_math::cot_fn | cot {} |
| Reciprocal tangent, retaining the input type and precision. | |
| constexpr detail::scalar_math::coth_fn | coth {} |
| Reciprocal hyperbolic tangent, retaining the input type and precision. | |
| constexpr detail::scalar_math::csc_fn | csc {} |
| Reciprocal sine, retaining the input type and precision. | |
| constexpr detail::scalar_math::csch_fn | csch {} |
| Reciprocal hyperbolic sine, retaining the input type and precision. | |
| constexpr detail::scalar_math::digamma_fn | digamma {} |
| Logarithmic derivative of Gamma. | |
| constexpr detail::scalar_math::dilog_real_fn | dilog_real {} |
| Real part of the dilogarithm. | |
| constexpr detail::scalar_math::erf_fn | erf {} |
| Real error function. | |
| constexpr detail::scalar_math::erfc_fn | erfc {} |
| Complementary error function without subtractive cancellation. | |
| constexpr detail::scalar_math::exp_fn | exp {} |
| Natural exponential with scalar-specific precision handling. | |
| constexpr detail::scalar_math::exp10_fn | exp10 {} |
| Base-ten exponential. | |
| constexpr detail::scalar_math::exp10m1_fn | exp10m1 {} |
| Ten to the power x minus one, using the cancellation-safe provider. | |
| constexpr detail::scalar_math::exp2_fn | exp2 {} |
| Base-two exponential. | |
| constexpr detail::scalar_math::exp2m1_fn | exp2m1 {} |
| Two to the power x minus one, using the cancellation-safe provider. | |
| constexpr detail::scalar_math::expint_fn | expint {} |
| Real principal-value exponential integral Ei. | |
| constexpr detail::scalar_math::expm1_fn | expm1 {} |
| Natural exponential minus one, evaluated without subtractive cancellation. | |
| constexpr detail::scalar_math::factorial_fn | factorial {} |
| MPFR factorial at an explicit arithmetic state; use uni20::factorial<Real> for a typed result. | |
| constexpr detail::scalar_math::fdim_fn | fdim {} |
| Positive difference, preserving NaN propagation. | |
| constexpr detail::scalar_math::floor_fn | floor {} |
| Round toward negative infinity. | |
| constexpr detail::scalar_math::fma_fn | fma {} |
| Fused multiplication and addition with one final rounding. | |
| constexpr detail::scalar_math::fmax_fn | fmax {} |
| Maximum, preferring the numeric operand over a NaN. | |
| constexpr detail::scalar_math::fmin_fn | fmin {} |
| Minimum, preferring the numeric operand over a NaN. | |
| constexpr detail::scalar_math::fmod_fn | fmod {} |
| Remainder using a quotient truncated toward zero. | |
| constexpr detail::scalar_math::frexp_fn | frexp {} |
| Binary fraction and exponent as an owning result. | |
| constexpr detail::scalar_math::hypot_fn | hypot {} |
| Euclidean length with scalar-specific overflow and underflow handling. | |
| constexpr detail::scalar_math::ilogb_fn | ilogb {} |
| Binary exponent of a finite nonzero value; throws otherwise. | |
| constexpr detail::scalar_math::imag_fn | imag {} |
| Read the imaginary component by value; real zero retains the input's type and precision. | |
| constexpr detail::scalar_math::isfinite_fn | isfinite {} |
| Whether a real scalar is finite. | |
| constexpr detail::scalar_math::isinf_fn | isinf {} |
| Whether a real scalar is infinite. | |
| constexpr detail::scalar_math::isnan_fn | isnan {} |
| Whether a real scalar is NaN. | |
| constexpr detail::scalar_math::ldexp_fn | ldexp {} |
| Multiply by a power of two using the scalar's exponent interface. | |
| constexpr detail::scalar_math::lgamma_fn | lgamma {} |
| Logarithm of the absolute Gamma function; native providers are reentrant. | |
| constexpr detail::scalar_math::lgamma_sign_fn | lgamma_sign {} |
| Log-absolute-Gamma and its sign as owning values. | |
| constexpr detail::scalar_math::log_fn | log {} |
| Natural logarithm with scalar-specific precision handling. | |
| constexpr detail::scalar_math::log10_fn | log10 {} |
| Base-ten logarithm. | |
| constexpr detail::scalar_math::log10p1_fn | log10p1 {} |
| Base-ten logarithm of one plus x, without rounding the sum first. | |
| constexpr detail::scalar_math::log1p_fn | log1p {} |
| Natural logarithm of one plus the argument, retaining small increments. | |
| constexpr detail::scalar_math::log2_fn | log2 {} |
| Base-two logarithm where supplied by the scalar implementation. | |
| constexpr detail::scalar_math::log2p1_fn | log2p1 {} |
| Base-two logarithm of one plus x, without rounding the sum first. | |
| constexpr detail::scalar_math::modf_fn | modf {} |
| Signed fractional and integral parts as an owning result. | |
| constexpr detail::scalar_math::next_down_fn | next_down {} |
| Adjacent value toward negative infinity. | |
| constexpr detail::scalar_math::next_up_fn | next_up {} |
| Adjacent value toward positive infinity. | |
| constexpr detail::scalar_math::nextafter_fn | nextafter {} |
| Adjacent value on the first operand grid toward the direction operand. | |
| constexpr detail::scalar_math::pow_fn | pow {} |
| Power with the selected scalar's domain, exactness and precision rules. | |
| constexpr detail::scalar_math::pown_fn | pown {} |
| Integer power with scalar-specific rounding. | |
| constexpr detail::scalar_math::real_fn | real {} |
| Read the real component by value; real and integral scalars retain their type. | |
| constexpr detail::scalar_math::remainder_fn | remainder {} |
| Remainder using the nearest-even integer quotient. | |
| constexpr detail::scalar_math::remquo_fn | remquo {} |
| Nearest-even remainder and signed low three quotient bits. | |
| constexpr detail::scalar_math::rootn_fn | rootn {} |
| Real integer-order root; negative orders give reciprocal roots. | |
| constexpr detail::scalar_math::round_fn | round {} |
| Round to nearest integer with ties away from zero. | |
| constexpr detail::scalar_math::round_even_fn | round_even {} |
| Nearest integer with ties to even. | |
| constexpr detail::scalar_math::scalbn_fn | scalbn {} |
| Binary scaling with a signed 64-bit exponent. | |
| constexpr detail::scalar_math::sec_fn | sec {} |
| Reciprocal cosine, retaining the input type and precision. | |
| constexpr detail::scalar_math::sech_fn | sech {} |
| Reciprocal hyperbolic cosine, retaining the input type and precision. | |
| constexpr detail::scalar_math::signbit_fn | signbit {} |
| Inspect the sign, including approximate negative zero. | |
| constexpr detail::scalar_math::sin_fn | sin {} |
| Sine with scalar-specific precision handling. | |
| constexpr detail::scalar_math::sincos_fn | sincos {} |
| Sine and cosine at one input. | |
| constexpr detail::scalar_math::sinh_fn | sinh {} |
| Hyperbolic sine. | |
| constexpr detail::scalar_math::sinhcosh_fn | sinhcosh {} |
| Hyperbolic sine and cosine at one input. | |
| constexpr detail::scalar_math::sinpi_fn | sinpi {} |
| Sine of pi times x, with argument reduction before multiplication by pi. | |
| constexpr detail::scalar_math::sqrt_fn | sqrt {} |
| Square root; exact inputs requiring approximation need an explicit finite precision. | |
| constexpr detail::scalar_math::tan_fn | tan {} |
| Tangent in radians. | |
| constexpr detail::scalar_math::tanh_fn | tanh {} |
| Hyperbolic tangent. | |
| constexpr detail::scalar_math::tanpi_fn | tanpi {} |
| Tangent of pi times x, with argument reduction before multiplication by pi. | |
| constexpr detail::scalar_math::tgamma_fn | tgamma {} |
| Real Gamma function. | |
| constexpr detail::scalar_math::trunc_fn | trunc {} |
| Round toward zero. | |
| constexpr detail::scalar_math::upper_gamma_fn | upper_gamma {} |
| Upper unregularized incomplete Gamma, with shape and lower integration endpoint. | |
| constexpr detail::scalar_math::zeta_fn | zeta {} |
| Real Riemann zeta with native Euler-Maclaurin evaluation and reflection. | |
Shared scalar math with native overloads and class-specific ADL customization.
Arguments are read through const references. Unsupported calls are constrained out; class scalars cannot obtain support merely by converting to a native floating type. Scalar overloads retain their exactness and precision rules, including trailing Precision arguments where supported. This interface currently targets host execution.
| auto uni20::math::abs_squared | ( | T const & | value | ) |
Square the magnitude, evaluating the scalar absolute value once.
This does not provide overflow scaling or extra working precision.
|
inlineconstexpr |
Absolute value or complex magnitude, preserving the selected scalar implementation.
|
inlineconstexpr |
Inverse cosine in radians.
|
inlineconstexpr |
Inverse hyperbolic cosine.
|
inlineconstexpr |
Principal arccosine divided by pi.
|
inlineconstexpr |
Nonnegative arithmetic-geometric mean.
Native arguments have the same real type. Zero with a finite argument gives +0; zero with infinity and other negative arguments give NaN. Native evaluation uses scaled iteration; MPFR retains its scalar precision contract.
|
inlineconstexpr |
Real Airy Ai; native inputs retain their precision and full negative-axis phase.
MPFR inputs retain their provider-specific range and working-precision rules.
|
inlineconstexpr |
Inverse sine in radians.
|
inlineconstexpr |
Inverse hyperbolic sine.
|
inlineconstexpr |
Principal arcsine divided by pi.
|
inlineconstexpr |
Inverse tangent in radians.
|
inlineconstexpr |
Quadrant-aware inverse tangent of y/x in radians.
|
inlineconstexpr |
Quadrant-aware arctangent divided by pi.
|
inlineconstexpr |
Inverse hyperbolic tangent.
|
inlineconstexpr |
Principal arctangent divided by pi.
|
inlineconstexpr |
Integer-order Bessel function of the first kind, with order first.
Native absolute orders must fit int; other scalar providers retain their own limits.
| std::out_of_range | if the order cannot be represented by the selected provider. |
|
inlineconstexpr |
Integer-order Bessel function of the second kind, with order first.
Native absolute orders must fit int; other scalar providers retain their own limits.
| std::out_of_range | if the order cannot be represented by the selected provider. |
|
inlineconstexpr |
Real Beta function.
Native arguments must have the same real type and both be positive; configured binary128 uses a scaled native Gamma-ratio algorithm. Advertised standard providers remain selected for float/double/long double. See docs/tensor/native_beta.md for fallback accuracy and range behavior.
|
inlineconstexpr |
Real cube root, including negative arguments.
|
inlineconstexpr |
Least integral value not less than the argument, in the scalar's result type.
|
inlineconstexpr |
Integer power of one plus x, retaining the original increment.
Requires x >= -1 and a checked signed-64-bit exponent (not bool). Native evaluation uses a typed provider or a guarded expansion; it does not promise correct rounding.
|
inlineconstexpr |
Complex conjugation; real and integral values retain their type.
|
inlineconstexpr |
Copy the sign while retaining the magnitude operand type and precision.
|
inlineconstexpr |
Cosine with scalar-specific precision handling.
|
inlineconstexpr |
Hyperbolic cosine.
|
inlineconstexpr |
Cosine of pi times x, with argument reduction before multiplication by pi.
|
inlineconstexpr |
Reciprocal tangent, retaining the input type and precision.
|
inlineconstexpr |
Reciprocal hyperbolic tangent, retaining the input type and precision.
|
inlineconstexpr |
Reciprocal sine, retaining the input type and precision.
|
inlineconstexpr |
Reciprocal hyperbolic sine, retaining the input type and precision.
|
inlineconstexpr |
Logarithmic derivative of Gamma.
Negative integer poles give NaN; signed zero gives an infinity of the opposite sign. Native evaluation uses recurrence and scaled-phase reflection; MPFR retains its scalar precision contract. See docs/tensor/native_digamma.md for absolute/relative accuracy targets near zeros and poles.
|
inlineconstexpr |
Real part of the dilogarithm.
Native real arguments use a bounded series with real continuation on x>1. Signed zeros are preserved; both infinite arguments give negative infinity.
|
inlineconstexpr |
Real error function.
|
inlineconstexpr |
Complementary error function without subtractive cancellation.
|
inlineconstexpr |
Natural exponential with scalar-specific precision handling.
|
inlineconstexpr |
Base-ten exponential.
|
inlineconstexpr |
Ten to the power x minus one, using the cancellation-safe provider.
|
inlineconstexpr |
Base-two exponential.
|
inlineconstexpr |
Two to the power x minus one, using the cancellation-safe provider.
|
inlineconstexpr |
Real principal-value exponential integral Ei.
Native evaluation uses compensated series, a positive E1 continued fraction and positive-Ei asymptotics, with scaling at range boundaries.
|
inlineconstexpr |
Natural exponential minus one, evaluated without subtractive cancellation.
|
inlineconstexpr |
MPFR factorial at an explicit arithmetic state; use uni20::factorial<Real> for a typed result.
|
inlineconstexpr |
Positive difference, preserving NaN propagation.
|
inlineconstexpr |
Round toward negative infinity.
|
inlineconstexpr |
Fused multiplication and addition with one final rounding.
|
inlineconstexpr |
Maximum, preferring the numeric operand over a NaN.
|
inlineconstexpr |
Minimum, preferring the numeric operand over a NaN.
|
inlineconstexpr |
Remainder using a quotient truncated toward zero.
|
inlineconstexpr |
Binary fraction and exponent as an owning result.
|
inlineconstexpr |
Euclidean length with scalar-specific overflow and underflow handling.
|
inlineconstexpr |
Binary exponent of a finite nonzero value; throws otherwise.
|
inlineconstexpr |
Read the imaginary component by value; real zero retains the input's type and precision.
|
inlineconstexpr |
Whether a real scalar is finite.
|
inlineconstexpr |
Whether a real scalar is infinite.
|
inlineconstexpr |
Whether a real scalar is NaN.
|
inlineconstexpr |
Multiply by a power of two using the scalar's exponent interface.
|
inlineconstexpr |
Logarithm of the absolute Gamma function; native providers are reentrant.
|
inlineconstexpr |
Log-absolute-Gamma and its sign as owning values.
Undefined signs are zero; signed zero retains its one-sided pole sign.
|
inlineconstexpr |
Natural logarithm with scalar-specific precision handling.
|
inlineconstexpr |
Base-ten logarithm.
|
inlineconstexpr |
Base-ten logarithm of one plus x, without rounding the sum first.
|
inlineconstexpr |
Natural logarithm of one plus the argument, retaining small increments.
|
inlineconstexpr |
Base-two logarithm where supplied by the scalar implementation.
|
inlineconstexpr |
Base-two logarithm of one plus x, without rounding the sum first.
|
inlineconstexpr |
Signed fractional and integral parts as an owning result.
|
inlineconstexpr |
Adjacent value toward negative infinity.
|
inlineconstexpr |
Adjacent value toward positive infinity.
|
inlineconstexpr |
Adjacent value on the first operand grid toward the direction operand.
|
inlineconstexpr |
Power with the selected scalar's domain, exactness and precision rules.
|
inlineconstexpr |
Integer power with scalar-specific rounding.
|
inlineconstexpr |
Read the real component by value; real and integral scalars retain their type.
|
inlineconstexpr |
Remainder using the nearest-even integer quotient.
|
inlineconstexpr |
Nearest-even remainder and signed low three quotient bits.
|
inlineconstexpr |
Real integer-order root; negative orders give reciprocal roots.
|
inlineconstexpr |
Round to nearest integer with ties away from zero.
|
inlineconstexpr |
Nearest integer with ties to even.
|
inlineconstexpr |
Binary scaling with a signed 64-bit exponent.
|
inlineconstexpr |
Reciprocal cosine, retaining the input type and precision.
|
inlineconstexpr |
Reciprocal hyperbolic cosine, retaining the input type and precision.
|
inlineconstexpr |
Inspect the sign, including approximate negative zero.
|
inlineconstexpr |
Sine with scalar-specific precision handling.
|
inlineconstexpr |
Sine and cosine at one input.
|
inlineconstexpr |
Hyperbolic sine.
|
inlineconstexpr |
Hyperbolic sine and cosine at one input.
|
inlineconstexpr |
Sine of pi times x, with argument reduction before multiplication by pi.
|
inlineconstexpr |
Square root; exact inputs requiring approximation need an explicit finite precision.
|
inlineconstexpr |
Tangent in radians.
|
inlineconstexpr |
Hyperbolic tangent.
|
inlineconstexpr |
Tangent of pi times x, with argument reduction before multiplication by pi.
|
inlineconstexpr |
Real Gamma function.
|
inlineconstexpr |
Round toward zero.
|
inlineconstexpr |
Upper unregularized incomplete Gamma, with shape and lower integration endpoint.
Native arguments must have matching real types. For a finite shape and positive endpoint, this is the positive integral from x to infinity; negative shapes are supported. At x=0 use the analytic Gamma endpoint. See docs/tensor/native_upper_gamma.md for domain and accuracy contracts. MPFR retains its scalar precision contract.
|
inlineconstexpr |
Real Riemann zeta with native Euler-Maclaurin evaluation and reflection.
Native arguments retain their type, including binary128. Exact negative even integers give positive zero; the pole at one gives positive infinity.