MCPcopy Create free account
hub / github.com/numpy/numpy / z_sqrt

Function z_sqrt

numpy/linalg/lapack_lite/f2c.c:669–688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667
668extern double f__cabs(double, double);
669void z_sqrt(doublecomplex *r, doublecomplex *z)
670#endif
671{
672double mag;
673
674if( (mag = f__cabs(z->r, z->i)) == 0.)
675 r->r = r->i = 0.;
676else if(z->r > 0)
677 {
678 r->r = sqrt(0.5 * (mag + z->r) );
679 r->i = z->i / r->r / 2;
680 }
681else
682 {
683 r->i = sqrt(0.5 * (mag - z->r) );
684 if(z->i < 0)
685 r->i = - r->i;
686 r->r = z->i / r->i / 2;
687 }
688}
689#ifdef __cplusplus
690extern "C" {
691#endif

Callers 3

zlahqr_Function · 0.85
zlaqr0_Function · 0.85
zlaqr4_Function · 0.85

Calls 2

f__cabsFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected