Doxygen Source Code Documentation
pow_ci.c File Reference
#include "f2c.h"Go to the source code of this file.
| Functions | |
| void | pow_zi (doublecomplex *, doublecomplex *, integer *) | 
| void | pow_ci (complex *p, complex *a, integer *b) | 
Function Documentation
| 
 | ||||||||||||||||
| 
 Definition at line 8 of file pow_ci.c. References a, doublecomplex::i, p, pow_zi(), and doublecomplex::r. 
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 8 of file pow_zi.c. References a, doublecomplex::i, p, doublecomplex::r, and z_div(). Referenced by pow_ci(). 
 00010 {
00011 integer n;
00012 unsigned long u;
00013 double t;
00014 doublecomplex x;
00015 static doublecomplex one = {1.0, 0.0};
00016 
00017 n = *b;
00018 p->r = 1;
00019 p->i = 0;
00020 
00021 if(n == 0)
00022         return;
00023 if(n < 0)
00024         {
00025         n = -n;
00026         z_div(&x, &one, a);
00027         }
00028 else
00029         {
00030         x.r = a->r;
00031         x.i = a->i;
00032         }
00033 
00034 for(u = n; ; )
00035         {
00036         if(u & 01)
00037                 {
00038                 t = p->r * x.r - p->i * x.i;
00039                 p->i = p->r * x.i + p->i * x.r;
00040                 p->r = t;
00041                 }
00042         if(u >>= 1)
00043                 {
00044                 t = x.r * x.r - x.i * x.i;
00045                 x.i = 2 * x.r * x.i;
00046                 x.r = t;
00047                 }
00048         else
00049                 break;
00050         }
00051 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  