numpy 2.0.0
src/umath/funcs.inc.src File Reference

Defines

#define SERIES_HORNER_TERM

Functions

static PyObject * Py_square (PyObject *o)
static PyObject * Py_get_one (PyObject *NPY_UNUSED(o))
static PyObject * Py_reciprocal (PyObject *o)
static PyObject * npy_ObjectPower (PyObject *x, PyObject *y)
static PyObject *npy_Object Kind (PyObject *i1, PyObject *i2)
static void nc_sum c (c @typ @*a, c @typ @*b, c @typ @*r)
static void nc_neg c (c @typ @*a, c @typ @*r)

Variables

static c typ nc_1 c = {1., 0.}

Define Documentation

#define SERIES_HORNER_TERM
Value:
@c@(result, x, coef)                  \
    do {                                                        \
        nc_prod@c@((result), (x), (result));                    \
        (result)->real *= (coef);                               \
        (result)->imag *= (coef);                               \
        nc_sum@c@((result), &nc_1@c@, (result));                \
    } while(0)
end repeat*

* COMPLEX FUNCTIONS **

Don't pass structures between functions (only pointers) because how structures are passed is compiler dependent and could cause segfaults if umath_ufunc_object.inc is compiled with a different compiler than an extension that makes use of the UFUNC API
begin repeat <blockquote> #typ = float, double, longdouble# c = f, ,l# C = F, ,L# #precision = 1,2,4#</blockquote>
Perform the operation result := 1 + coef * x * result, with real coefficient <cite>coef</cite>.

Function Documentation

static void nc_sum c ( c @typ @*  a,
c @typ @*  b,
c @typ @*  r 
) [static]
static c&#64;typ&#64; nc_mi&#64;c&#64; = {0.0&#64;c&#64;, -1.0&#64;c&#64;}; static c&#64;typ&#64; nc_pi2&#64;c&#64; = {NPY_PI_2&#64;c&#64;., 0.0&#64;c&#64;};

NB: there are four complex zeros; c0 = (+-0, +-0), so that unlike

for reals, c0**p, with <cite>p</cite> negative is in general ill-defined.

c0**z with z complex is also ill-defined.

Raise invalid
unroll: handle inf better
unroll: handle inf better
unroll: handle inf better

static void nc_neg c ( c @typ @*  a,
c @typ @*  r 
) [static]

return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))));
return nc_log(nc_sum(x, nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1)))));
return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))));
Small arguments: series expansion, to avoid loss of precision asin(x) = x [1 + (1/6) x^2 [1 + (9/20) x^2 [1 + ...]]]
|x| < 1e-3 => |rel. error| < 1e-18 (f), 1e-24, 1e-36 (l)

Docutils System Messages

System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "x".
System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "rel. error".
return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x));
Small arguments: series expansion, to avoid loss of precision asinh(x) = x [1 - (1/6) x^2 [1 - (9/20) x^2 [1 - ...]]]
|x| < 1e-3 => |rel. error| < 1e-18 (f), 1e-24, 1e-36 (l)

Docutils System Messages

System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "x".
System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "rel. error".
return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x))));
Small arguments: series expansion, to avoid loss of precision atan(x) = x [1 - (1/3) x^2 [1 - (3/5) x^2 [1 - ...]]]
|x| < 1e-3 => |rel. error| < 1e-18 (f), 1e-24, 1e-36 (l)

Docutils System Messages

System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "x".
System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "rel. error".
return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x))));
Small arguments: series expansion, to avoid loss of precision atan(x) = x [1 + (1/3) x^2 [1 + (3/5) x^2 [1 + ...]]]
|x| < 1e-3 => |rel. error| < 1e-18 (f), 1e-24, 1e-36 (l)

Docutils System Messages

System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "x".
System Message: ERROR/3 (<string>, line 4); backlink Undefined substitution referenced: "rel. error".

static PyObject* npy_Object Kind ( PyObject *  i1,
PyObject *  i2 
) [static]
begin repeat
Kind = Max, Min# #OP = >=, <=#
static PyObject* npy_ObjectPower ( PyObject *  x,
PyObject *  y 
) [static]
Define numpy version of PyNumber_Power as binary function.
static PyObject* Py_get_one ( PyObject *  NPY_UNUSEDo) [static]
static PyObject* Py_reciprocal ( PyObject *  o) [static]
static PyObject* Py_square ( PyObject *  o) [static]
This file is for the definitions of the non-c99 functions used in ufuncs. All the complex ufuncs are defined here along with a smattering of real and object functions.

* PYTHON OBJECT FUNCTIONS **


Variable Documentation

static void nc_tanh c = {1., 0.} [static]
constants

NB: there are four complex zeros; c0 = (+-0, +-0), so that unlike

for reals, c0**p, with <cite>p</cite> negative is in general ill-defined.

c0**z with z complex is also ill-defined.

Raise invalid
unroll: handle inf better
unroll: handle inf better
unroll: handle inf better

Referenced by _copyswap(), _fromstr(), _strided_byte_swap(), _strided_to_strided(), BOOL_scan(), c(), HALF_modf(), HALF_nextafter(), HALF_ones_like(), NumPyOS_ascii_isspace(), TIMEDELTA_md_m_multiply(), and TIMEDELTA_mm_d_divide().