Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

c_div.c File Reference

#include "f2c.h"

Go to the source code of this file.


Functions

void sig_die (char *, int)
void c_div (complex *c, complex *a, complex *b)

Function Documentation

void c_div complex   c,
complex   a,
complex   b
 

Definition at line 9 of file c_div.c.

References a, c, and sig_die().

00011 {
00012 double ratio, den;
00013 double abr, abi;
00014 
00015 if( (abr = b->r) < 0.)
00016         abr = - abr;
00017 if( (abi = b->i) < 0.)
00018         abi = - abi;
00019 if( abr <= abi )
00020         {
00021         if(abi == 0)
00022                 sig_die("complex division by zero", 1);
00023         ratio = (double)b->r / b->i ;
00024         den = b->i * (1 + ratio*ratio);
00025         c->r = (a->r*ratio + a->i) / den;
00026         c->i = (a->i*ratio - a->r) / den;
00027         }
00028 
00029 else
00030         {
00031         ratio = (double)b->i / b->r ;
00032         den = b->r * (1 + ratio*ratio);
00033         c->r = (a->r + a->i*ratio) / den;
00034         c->i = (a->i - a->r*ratio) / den;
00035         }
00036 }

void sig_die char *   ,
int   
 

 

Powered by Plone

This site conforms to the following standards: