picop.cycomplex#

Fast complex helpers.

picop.cycomplex.complex_check(p)#

Return True if p is a complex or subtype (PyComplex_Check).

Parameters:

p (object)

Return type:

bool

picop.cycomplex.complex_check_exact(p)#

Return True if type(p) is complex (PyComplex_CheckExact).

Parameters:

p (object)

Return type:

bool

picop.cycomplex.complex_eq(a, b)#

Return True if values are equal with Python complex parity.

Notes

NaN on either real or imag part yields unequal (CPython parity).

Parameters:
Return type:

bool

picop.cycomplex.complex_from_doubles(real, imag)#

Return complex(real, imag) via PyComplex_FromDoubles.

Parameters:
Return type:

object

picop.cycomplex.complex_imag_as_double(op)#

Return the imaginary part of op as a C double (PyComplex_ImagAsDouble).

Parameters:

op (object)

Return type:

float

picop.cycomplex.complex_real_as_double(op)#

Return the real part of op as a C double (PyComplex_RealAsDouble).

Notes

Mixed Tier A parity: 0.62x (Z.real), 1.70x (int 7); unpacks a complex into C doubles.

Parameters:

op (object)

Return type:

float