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

Function c_sqrt

numpy/linalg/lapack_lite/f2c.c:640–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638
639extern double f__cabsf(float, float);
640void c_sqrt(complex *r, complex *z)
641#endif
642{
643float mag;
644
645if( (mag = f__cabsf(z->r, z->i)) == 0.f)
646 r->r = r->i = 0.f;
647else if(z->r > 0.0f)
648 {
649 r->r = sqrtf(0.5f * (mag + z->r) );
650 r->i = z->i / r->r / 2.0f;
651 }
652else
653 {
654 r->i = sqrtf(0.5f * (mag - z->r) );
655 if(z->i < 0.0f)
656 r->i = - r->i;
657 r->r = z->i / r->i / 2.0f;
658 }
659}
660
661
662#ifdef KR_headers

Callers 3

clahqr_Function · 0.85
claqr0_Function · 0.85
claqr4_Function · 0.85

Calls 1

f__cabsfFunction · 0.85

Tested by

no test coverage detected