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  

eis_csroot.c

Go to the documentation of this file.
00001 /* csroot.f -- translated by f2c (version 19961017).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 
00008 /* Subroutine */ int csroot_(doublereal *xr, doublereal *xi, doublereal *yr, 
00009         doublereal *yi)
00010 {
00011     /* Builtin functions */
00012     double sqrt(doublereal);
00013 
00014     /* Local variables */
00015     static doublereal s, ti, tr;
00016     extern doublereal pythag_(doublereal *, doublereal *);
00017 
00018 
00019 /*     (YR,YI) = COMPLEX DSQRT(XR,XI) */
00020 /*     BRANCH CHOSEN SO THAT YR .GE. 0.0 AND SIGN(YI) .EQ. SIGN(XI) */
00021 
00022     tr = *xr;
00023     ti = *xi;
00024     s = sqrt((pythag_(&tr, &ti) + abs(tr)) * .5);
00025     if (tr >= 0.) {
00026         *yr = s;
00027     }
00028     if (ti < 0.) {
00029         s = -s;
00030     }
00031     if (tr <= 0.) {
00032         *yi = s;
00033     }
00034     if (tr < 0.) {
00035         *yr = ti / *yi * .5;
00036     }
00037     if (tr > 0.) {
00038         *yi = ti / *yr * .5;
00039     }
00040     return 0;
00041 } /* csroot_ */
00042 
 

Powered by Plone

This site conforms to the following standards: