|
Stratax 0.3.1
|
Version: v0.2.0
Status: Complete
Header: include/stratax/ops/Math.hpp
Math.hpp provides element-wise mathematical functions for Stratax arrays. Unary functions preserve the input container and shape. Binary functions use NumPy-style broadcasting and return the promoted container and dtype.
Integral input to standard transcendental functions is promoted to dtype::float64. Floating-point and complex inputs otherwise retain their dtype. abs() returns the real component dtype for complex input.
| Category | Functions |
|---|---|
| Roots | sqrt, cbrt |
| Exponentials | exp, exp2, expm1 |
| Logarithms | log, log2, log10, log1p, logb |
| Trigonometric | sin, cos, tan |
| Inverse trigonometric | asin, acos, atan |
| Hyperbolic | sinh, cosh, tanh |
| Inverse hyperbolic | asinh, acosh, atanh |
| Magnitude | abs |
| Special | erf, erfc, tgamma, lgamma |
| Rounding | floor, ceil, trunc, round, nearbyint, rint |
Every unary operation returns independent storage with the input shape and container type. Rounding functions require real numeric elements. Other unary functions accept numeric elements, including complex values where supported by the corresponding standard-library operation.
Complexity: O(n), where n is the input element count.
Both operands are arrays. Their shapes are broadcast to a common result shape, and their dtypes and container types are promoted. Integral-only operands produce dtype::float64 results.
Throws Exceptions::BroadcastError when the operand shapes are incompatible.
Complexity: O(nr), where n is result size and r is result rank.