MCPcopy Create free account
hub / github.com/pydata/numexpr / _inline_div

Function _inline_div

numexpr3/complex_functions.hpp:437–444  ·  view source on GitHub ↗

The naive complex division function here is not very accurate and sometimes fails the autotest assert. Probably there's something better... https://arxiv.org/pdf/1210.4539.pdf or https://arxiv.org/pdf/1608.07596.pdf Most complex division algorithms seem to have a branch however, which would take a bit of work to avoid.

Source from the content-addressed store, hash-verified

435// Most complex division algorithms seem to have a branch however, which
436// would take a bit of work to avoid.
437static inline void
438_inline_div( npy_complex64 a, npy_complex64 b, npy_complex64 &r)
439{
440 npy_float32 d = 1.0f/(b.real*b.real + b.imag*b.imag);
441 r.real = (a.real*b.real + a.imag*b.imag)*d;
442 r.imag = (a.imag*b.real - a.real*b.imag)*d;
443
444}
445static inline void
446_inline_div( npy_complex128 a, npy_complex128 b, npy_complex128 &r)
447{

Callers 3

nc_divFunction · 0.85
nc_atanFunction · 0.85
nc_atanhFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…