Trigonometric, hyperbolic, exponential, logarithmic, complex, and rounding operations. More...
Files | |
| file | elfun.hpp |
| Elementary mathematical functions (trigonometry, exp, log, complex numbers, rounding). | |
Classes | |
| struct | nk::builtin::PolarPair |
| Result of 2D Cartesian to polar conversion ([theta, rho] = cart2pol(x, y)). More... | |
| struct | nk::builtin::CylTriple |
| Result of 3D Cartesian to cylindrical conversion ([theta, rho, z] = cart2pol(x, y, z)). More... | |
| struct | nk::builtin::CartPair |
| Result of 2D polar to Cartesian conversion ([x, y] = pol2cart(theta, rho)). More... | |
| struct | nk::builtin::CartTriple |
| Result of 3D cylindrical/spherical to Cartesian conversion ([x, y, z]). More... | |
| struct | nk::builtin::SphTriple |
| Result of 3D Cartesian to spherical conversion ([az, el, r] = cart2sph(x, y, z)). More... | |
Functions | |
| Value | nk::builtin::sin (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise sine in radians (y = sin(x)). | |
| Value | nk::builtin::cos (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cosine in radians (y = cos(x)). | |
| Value | nk::builtin::tan (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise tangent in radians (y = tan(x)). | |
| Value | nk::builtin::asin (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse sine in radians (y = asin(x)). | |
| Value | nk::builtin::acos (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cosine in radians (y = acos(x)). | |
| Value | nk::builtin::atan (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse tangent in radians (y = atan(x)). | |
| Value | nk::builtin::atan2 (const Value &y, const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Four-quadrant inverse tangent in radians (theta = atan2(y, x)). | |
| Value | nk::builtin::sec (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise secant in radians (y = sec(x) = 1 / cos(x)). | |
| Value | nk::builtin::csc (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cosecant in radians (y = csc(x) = 1 / sin(x)). | |
| Value | nk::builtin::cot (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cotangent in radians (y = cot(x) = 1 / tan(x)). | |
| Value | nk::builtin::asec (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse secant in radians (y = asec(x)). | |
| Value | nk::builtin::acsc (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cosecant in radians (y = acsc(x)). | |
| Value | nk::builtin::acot (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cotangent in radians (y = acot(x)). | |
| Value | nk::builtin::sind (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise sine in degrees (y = sind(x)). | |
| Value | nk::builtin::cosd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cosine in degrees (y = cosd(x)). | |
| Value | nk::builtin::tand (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise tangent in degrees (y = tand(x)). | |
| Value | nk::builtin::asind (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse sine in degrees (y = asind(x)). | |
| Value | nk::builtin::acosd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cosine in degrees (y = acosd(x)). | |
| Value | nk::builtin::atand (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse tangent in degrees (y = atand(x)). | |
| Value | nk::builtin::atan2d (const Value &y, const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Four-quadrant inverse tangent in degrees (theta = atan2d(y, x)). | |
| Value | nk::builtin::secd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise secant in degrees (y = secd(x)). | |
| Value | nk::builtin::cscd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cosecant in degrees (y = cscd(x)). | |
| Value | nk::builtin::cotd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cotangent in degrees (y = cotd(x)). | |
| Value | nk::builtin::asecd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse secant in degrees (y = asecd(x)). | |
| Value | nk::builtin::acscd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cosecant in degrees (y = acscd(x)). | |
| Value | nk::builtin::acotd (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise inverse cotangent in degrees (y = acotd(x)). | |
| Value | nk::builtin::sinpi (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise sine of pi times input (y = sin(pi * x)). | |
| Value | nk::builtin::cospi (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Elementwise cosine of pi times input (y = cos(pi * x)). | |
| Value | nk::builtin::deg2rad (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Converts angles from degrees to radians (y = deg2rad(x)). | |
| Value | nk::builtin::rad2deg (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Converts angles from radians to degrees (y = rad2deg(x)). | |
| Value | nk::builtin::wrapToPi (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Wraps angles in radians to interval [-pi, pi]. | |
| Value | nk::builtin::wrapTo2Pi (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Wraps angles in radians to interval [0, 2*pi). | |
| Value | nk::builtin::wrapTo180 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Wraps angles in degrees to interval [-180, 180]. | |
| Value | nk::builtin::wrapTo360 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Wraps angles in degrees to interval [0, 360). | |
| Value | nk::builtin::sinh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic sine (y = sinh(x)). | |
| Value | nk::builtin::cosh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic cosine (y = cosh(x)). | |
| Value | nk::builtin::tanh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic tangent (y = tanh(x)). | |
| Value | nk::builtin::asinh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic sine (y = asinh(x)). | |
| Value | nk::builtin::acosh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic cosine (y = acosh(x)). | |
| Value | nk::builtin::atanh (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic tangent (y = atanh(x)). | |
| Value | nk::builtin::sech (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic secant (y = sech(x) = 1 / cosh(x)). | |
| Value | nk::builtin::csch (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic cosecant (y = csch(x) = 1 / sinh(x)). | |
| Value | nk::builtin::coth (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Hyperbolic cotangent (y = coth(x) = 1 / tanh(x)). | |
| Value | nk::builtin::asech (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic secant (y = asech(x)). | |
| Value | nk::builtin::acsch (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic cosecant (y = acsch(x)). | |
| Value | nk::builtin::acoth (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Inverse hyperbolic cotangent (y = acoth(x)). | |
| PolarPair | nk::builtin::cart2pol (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Transforms 2D Cartesian coordinates to polar coordinates ([theta, rho] = cart2pol(x, y)). | |
| CylTriple | nk::builtin::cart2pol (const Value &x, const Value &y, const Value &z, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D Cartesian coordinates to cylindrical coordinates ([theta, rho, z] = cart2pol(x, y, z)). | |
| CartPair | nk::builtin::pol2cart (const Value &theta, const Value &rho, std::pmr::memory_resource *mr=nullptr) |
| Transforms 2D polar coordinates to Cartesian coordinates ([x, y] = pol2cart(theta, rho)). | |
| CartTriple | nk::builtin::pol2cart (const Value &theta, const Value &rho, const Value &z, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D cylindrical coordinates to Cartesian coordinates ([x, y, z] = pol2cart(theta, rho, z)). | |
| SphTriple | nk::builtin::cart2sph (const Value &x, const Value &y, const Value &z, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D Cartesian coordinates to spherical coordinates ([az, el, r] = cart2sph(x, y, z)). | |
| CartTriple | nk::builtin::sph2cart (const Value &az, const Value &el, const Value &r, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D spherical coordinates to Cartesian coordinates ([x, y, z] = sph2cart(az, el, r)). | |
| Value | nk::builtin::cart2pol (Span< const Value > args, std::pmr::memory_resource *mr=nullptr) |
| Transforms 2D Cartesian coordinates to polar coordinates (span wrapper). | |
| Value | nk::builtin::pol2cart (Span< const Value > args, std::pmr::memory_resource *mr=nullptr) |
| Transforms 2D polar coordinates to Cartesian coordinates (span wrapper). | |
| Value | nk::builtin::cart2sph (Span< const Value > args, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D Cartesian coordinates to spherical coordinates (span wrapper). | |
| Value | nk::builtin::sph2cart (Span< const Value > args, std::pmr::memory_resource *mr=nullptr) |
| Transforms 3D spherical coordinates to Cartesian coordinates (span wrapper). | |
| Value | nk::builtin::exp (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Natural exponential (y = exp(x)). | |
| Value | nk::builtin::expm1 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Computes exp(x) - 1 accurately for small x. | |
| Value | nk::builtin::log (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Natural logarithm (ln(x)). | |
| Value | nk::builtin::log10 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Base-10 logarithm (log10(x)). | |
| Value | nk::builtin::log2 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Base-2 logarithm (log2(x)). | |
| Value | nk::builtin::log1p (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Computes log(1 + x) accurately for small x. | |
| Value | nk::builtin::pow2 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Base-2 power scaling (y = 2.
| |
| Value | nk::builtin::pow2 (const Value &f, const Value &e, std::pmr::memory_resource *mr=nullptr) |
| Base-2 power scaling with mantissa and exponent (y = f .
| |
| Value | nk::builtin::nextpow2 (const Value &n, std::pmr::memory_resource *mr=nullptr) |
| Smallest integer exponent such that 2^p >= abs(n) (p = nextpow2(n)). | |
| Value | nk::builtin::sqrt (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Square root (y = sqrt(x)). | |
| Value | nk::builtin::realsqrt (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Real square root with domain error check (y = realsqrt(x)). | |
| Value | nk::builtin::reallog (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Real natural logarithm with domain error check (y = reallog(x)). | |
| Value | nk::builtin::cbrt (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Cube root (y = cbrt(x)). | |
| Value | nk::builtin::nthroot (const Value &x, const Value &n, std::pmr::memory_resource *mr=nullptr) |
| Real nth root of real numbers (y = nthroot(x, n)). | |
| Value | nk::builtin::hypot (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Square root of sum of squares (hypot(x, y) = sqrt(x^2 + y^2)). | |
| Value | nk::builtin::pow (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Elementwise power (z = x .
| |
| Value | nk::builtin::realpow (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Real power with complex error check (y = realpow(x, y)). | |
| Value | nk::builtin::real (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Real part of complex array (y = real(x)). | |
| Value | nk::builtin::imag (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Imaginary part of complex array (y = imag(x)). | |
| Value | nk::builtin::conj (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Complex conjugate (y = conj(x)). | |
| Value | nk::builtin::angle (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Phase angle of complex numbers in radians (y = angle(x)). | |
| Value | nk::builtin::abs (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Absolute value / complex magnitude (y = abs(x)). | |
| Value | nk::builtin::complex (const Value &re, std::pmr::memory_resource *mr=nullptr) |
| Constructs complex array from real part (complex(re)). | |
| Value | nk::builtin::complex (const Value &re, const Value &im, std::pmr::memory_resource *mr=nullptr) |
| Constructs complex array from real and imaginary parts (complex(re, im)). | |
| Value | nk::builtin::sign (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Signum function (-1, 0, 1 or unit complex phasor). | |
| Value | nk::builtin::unwrap (const Value &p, double tol=3.14159265358979323846, int dim=-1, std::pmr::memory_resource *mr=nullptr) |
| Unwraps phase angles across array dimensions. | |
| Value | nk::builtin::isreal (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Tests if array contains real values (false if complex storage is active). | |
| Value | nk::builtin::round (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Rounds elements to the nearest integer (y = round(x)). | |
| Value | nk::builtin::roundN (const Value &x, int n, bool significant=false, std::pmr::memory_resource *mr=nullptr) |
| Rounds elements to N decimal digits or N significant digits (round(x, n, type)). | |
| Value | nk::builtin::floor (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Rounds down towards negative infinity (y = floor(x)). | |
| Value | nk::builtin::ceil (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Rounds up towards positive infinity (y = ceil(x)). | |
| Value | nk::builtin::fix (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Rounds towards zero / truncate (y = fix(x)). | |
| Value | nk::builtin::subplus (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Positive part / rectifier (y = max(x, 0)). | |
| Value | nk::builtin::mod (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Modulo operation where sign of result matches divisor (y = mod(x, y)). | |
| Value | nk::builtin::rem (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Remainder after division where sign of result matches dividend (y = rem(x, y)). | |
Trigonometric, hyperbolic, exponential, logarithmic, complex, and rounding operations.
Absolute value / complex magnitude (y = abs(x)).
Computes |x| for real numbers and sqrt(re^2 + im^2) for complex numbers. Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
Elementwise inverse cosine in radians (y = acos(x)).
Computes arccosine. Returns real values in [0, pi] for domain [-1, 1]; generates complex outputs for values outside the real domain.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
Elementwise inverse sine in radians (y = asin(x)).
Computes arcsine. Returns real values in [-pi/2, pi/2] for domain [-1, 1]; generates complex outputs for values outside the real domain.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::atan2 | ( | const Value & | y, |
| const Value & | x, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Four-quadrant inverse tangent in radians (theta = atan2(y, x)).
Computes the angle in the Euclidean plane between the positive x-axis and the point (x, y). Handles broadcast shapes between y and x.
| y | Y coordinates. |
| x | X coordinates. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::atan2d | ( | const Value & | y, |
| const Value & | x, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Four-quadrant inverse tangent in degrees (theta = atan2d(y, x)).
Computes angle in degrees in [-180, 180]. Handles broadcast shapes.
| y | Y coordinates. |
| x | X coordinates. |
| mr | Memory resource for allocations (nullptr for default). |
| CylTriple nk::builtin::cart2pol | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | z, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 3D Cartesian coordinates to cylindrical coordinates ([theta, rho, z] = cart2pol(x, y, z)).
| x | X Cartesian coordinates. |
| y | Y Cartesian coordinates. |
| z | Z Cartesian coordinates. |
| mr | Memory resource for allocations (nullptr for default). |
| PolarPair nk::builtin::cart2pol | ( | const Value & | x, |
| const Value & | y, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 2D Cartesian coordinates to polar coordinates ([theta, rho] = cart2pol(x, y)).
Computes theta = atan2(y, x) and rho = hypot(x, y) elementwise.
| x | X Cartesian coordinates. |
| y | Y Cartesian coordinates. |
| mr | Memory resource for allocations (nullptr for default). |
Transforms 2D Cartesian coordinates to polar coordinates (span wrapper).
| args | Span containing x and y. |
| mr | Memory resource. |
| SphTriple nk::builtin::cart2sph | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | z, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 3D Cartesian coordinates to spherical coordinates ([az, el, r] = cart2sph(x, y, z)).
Computes az = atan2(y, x), el = atan2(z, hypot(x, y)), and r = sqrt(x^2 + y^2 + z^2).
| x | X Cartesian coordinates. |
| y | Y Cartesian coordinates. |
| z | Z Cartesian coordinates. |
| mr | Memory resource for allocations (nullptr for default). |
Transforms 3D Cartesian coordinates to spherical coordinates (span wrapper).
| args | Span containing x, y, z. |
| mr | Memory resource. |
Elementwise cosine in radians (y = cos(x)).
Computes trigonometric cosine for real and complex input arrays. Accelerated with Highway SIMD vectorization.
| x | Input array in radians. |
| mr | Memory resource for allocations (nullptr for default). |
Hyperbolic cosine (y = cosh(x)).
Computes (exp(x) + exp(-x)) / 2 elementwise for real and complex arrays. Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
Natural exponential (y = exp(x)).
Computes e^x elementwise for real and complex input arrays. Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::hypot | ( | const Value & | x, |
| const Value & | y, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Square root of sum of squares (hypot(x, y) = sqrt(x^2 + y^2)).
Computes the hypotenuse accurately without intermediate overflow or underflow.
| x | First argument array. |
| y | Second argument array. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::nthroot | ( | const Value & | x, |
| const Value & | n, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Real nth root of real numbers (y = nthroot(x, n)).
Computes the real nth root of elements in x. Handles negative x for odd integer n.
| x | Real base array. |
| n | Real root degree. |
| mr | Memory resource for allocations (nullptr for default). |
| CartTriple nk::builtin::pol2cart | ( | const Value & | theta, |
| const Value & | rho, | ||
| const Value & | z, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 3D cylindrical coordinates to Cartesian coordinates ([x, y, z] = pol2cart(theta, rho, z)).
| theta | Azimuth angle array in radians. |
| rho | Radial distance in xy-plane array. |
| z | Height coordinate array. |
| mr | Memory resource for allocations (nullptr for default). |
| CartPair nk::builtin::pol2cart | ( | const Value & | theta, |
| const Value & | rho, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 2D polar coordinates to Cartesian coordinates ([x, y] = pol2cart(theta, rho)).
Computes x = rho .* cos(theta) and y = rho .* sin(theta) elementwise.
| theta | Angle array in radians. |
| rho | Radial distance array. |
| mr | Memory resource for allocations (nullptr for default). |
Transforms 2D polar coordinates to Cartesian coordinates (span wrapper).
| args | Span containing th and r. |
| mr | Memory resource. |
Real natural logarithm with domain error check (y = reallog(x)).
Computes natural log elementwise, raising a runtime error if any element is non-positive.
| x | Input array of positive real numbers. |
| mr | Memory resource for allocations (nullptr for default). |
Real square root with domain error check (y = realsqrt(x)).
Computes square root elementwise, raising a runtime domain error if any element is negative.
| x | Input array of non-negative real numbers. |
| mr | Memory resource for allocations (nullptr for default). |
Rounds elements to the nearest integer (y = round(x)).
Rounds half-integers away from zero (MATLAB round semantics). Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::roundN | ( | const Value & | x, |
| int | n, | ||
| bool | significant = false, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Rounds elements to N decimal digits or N significant digits (round(x, n, type)).
| x | Input array. |
| n | Number of decimal or significant digits. |
| significant | True to round to significant digits, false for decimal places. |
| mr | Memory resource for allocations (nullptr for default). |
Signum function (-1, 0, 1 or unit complex phasor).
For real numbers, returns 1 for x > 0, -1 for x < 0, and 0 for x == 0. For complex numbers, returns x ./ abs(x).
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
Elementwise sine in radians (y = sin(x)).
Computes trigonometric sine for real and complex input arrays. Accelerated with Highway SIMD vectorization.
| x | Input array in radians. |
| mr | Memory resource for allocations (nullptr for default). |
Hyperbolic sine (y = sinh(x)).
Computes (exp(x) - exp(-x)) / 2 elementwise for real and complex arrays. Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
| CartTriple nk::builtin::sph2cart | ( | const Value & | az, |
| const Value & | el, | ||
| const Value & | r, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Transforms 3D spherical coordinates to Cartesian coordinates ([x, y, z] = sph2cart(az, el, r)).
Computes x = r .* cos(el) .* cos(az), y = r .* cos(el) .* sin(az), and z = r .* sin(el).
| az | Azimuth angle in radians. |
| el | Elevation angle in radians. |
| r | Radial distance from origin. |
| mr | Memory resource for allocations (nullptr for default). |
Transforms 3D spherical coordinates to Cartesian coordinates (span wrapper).
| args | Span containing az, el, r. |
| mr | Memory resource. |
Square root (y = sqrt(x)).
Computes square root elementwise. Produces complex numbers for negative inputs. Accelerated with Highway SIMD vectorization.
| x | Input array. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::unwrap | ( | const Value & | p, |
| double | tol = 3.14159265358979323846, | ||
| int | dim = -1, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Unwraps phase angles across array dimensions.
Corrects the radian phase angles in p by adding multiples of ±2*pi whenever jump discontinuities exceed tol.
| p | Phase angle array in radians. |
| tol | Jump tolerance threshold (default: pi). |
| dim | Dimension along which to operate (-1 for first non-singleton dimension). |
| mr | Memory resource for allocations (nullptr for default). |