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

Function c_abs

numpy/linalg/lapack_lite/f2c.c:539–584  ·  view source on GitHub ↗
(z)

Source from the content-addressed store, hash-verified

537#ifdef KR_headers
538double f__cabsf();
539double c_abs(z) complex *z;
540#else
541double f__cabsf(float, float);
542double c_abs(complex *z)
543#endif
544{
545return( f__cabsf( z->r, z->i ) );
546}
547
548#ifdef KR_headers
549double f__cabs();
550double z_abs(z) doublecomplex *z;
551#else
552double f__cabs(double, double);
553double z_abs(doublecomplex *z)
554#endif
555{
556return( f__cabs( z->r, z->i ) );
557}
558
559
560#ifdef KR_headers
561extern void sig_die();
562VOID c_div(c, a, b) complex *a, *b, *c;
563#else
564extern void sig_die(char*, int);
565void c_div(complex *c, complex *a, complex *b)
566#endif
567{
568float ratio, den;
569float abr, abi;
570
571if( (abr = b->r) < 0.f)
572 abr = - abr;
573if( (abi = b->i) < 0.f)
574 abi = - abi;
575if( abr <= abi )
576 {
577 /*Let IEEE Infinities handle this ;( */
578 /*if(abi == 0)
579 sig_die("complex division by zero", 1);*/
580 ratio = b->r / b->i ;
581 den = b->i * (1 + ratio*ratio);
582 c->r = (a->r*ratio + a->i) / den;
583 c->i = (a->i*ratio - a->r) / den;
584 }
585
586else
587 {

Callers 5

cgebal_Function · 0.85
cgetf2_Function · 0.85
clahqr_Function · 0.85
clange_Function · 0.85
clanhe_Function · 0.85

Calls 2

f__cabsfFunction · 0.85
f__cabsFunction · 0.85

Tested by

no test coverage detected