Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

basis.h

Go to the documentation of this file.
00001 // Header file of basis_r.cpp
00002 
00003 /***********************************************************************
00004 *                                                                      *
00005 * Basic functions: Declarations file (with types and macros)           *
00006 * ----------------------------------------------------------           *
00007 *                                                                      *
00008 * Programming language: ANSI C                                         *
00009 * Compiler:             Turbo C 2.0                                    *
00010 * Computer:             IBM PS/2 70 with 80387                         *
00011 * Author:               Juergen Dietel, Computer Center, RWTH Aachen   *
00012 *                       [BIBLI 11].                                    *
00013 * Date:                 9.30.1992                                      *
00014 *                                                                      *
00015 ***********************************************************************/
00016 
00017 
00018 
00019 /***********************************************************************
00020 * Make preparations in case this declarations file is included more    *
00021 * than once in a source code                                           *
00022 ***********************************************************************/
00023 
00024 #ifndef BASIS_H_INCLUDED
00025 #define BASIS_H_INCLUDED
00026 
00027 
00028 
00029 /***********************************************************************
00030 * Include a few other declarations file here.                          *
00031 * We include the standard declarations files here mainly so that only  *
00032 * this file needs to be included in the C modules of the Numerical     *
00033 * Library in order to have access to all standard names and variables. *
00034 * Moreover modifications for nonstandard compilers may then be limited *
00035 * to this file only.                                                   *
00036 ***********************************************************************/
00037 
00038 #ifdef __EMX__            /* emx 0.9b with GNU CC 2.7.2?              */
00039 #if __GNUC__ == 2         /* To prevent a compiler crash in           */
00040 #if __GNUC_MINOR__ == 7   /* `15\gax.c' while compiling with LDOUBLE, */
00041 #define EMX09B            /* by defining the macro _WITH_UNDERSCORE   */
00042 #define _WITH_UNDERSCORE  /* the special variants of the mathematical */
00043 #define fabsl _fabsl      /* functions for `long double' in `math.h'  */
00044 #define sqrtl _sqrtl      /* are activated and their use further      */
00045 #define powl  _powl       /* below in shape of the macros FABS, SQRT, */
00046 #define sinl  _sinl       /* ... is prepared here; which seems quite  */
00047 #define cosl  _cosl       /* useful even without the affair with the  */
00048 #define expl  _expl       /* crashing compiler.                       */
00049 #define logl  _logl
00050 #define atanl _atanl
00051 #define acosl _acosl
00052 #define coshl _coshl
00053 #endif
00054 #endif
00055 #endif
00056 
00057 #include <stdlib.h>
00058 #include <stdio.h>
00059 #include <math.h>     /*  for  fabs, sqrt, pow, exp, sin, cos, log,   */
00060                       /*       atan, acos                             */
00061 #include <float.h>    /*  for  DBL_EPSILON, DBL_MAX */ 
00062 #include <string.h>
00063                  
00064 #ifdef sun            /*  for  GNU CC under SunOS                     */
00065 #include <unistd.h>   /*  for  SEEK_END                               */
00066 #else
00067 #ifdef amigados       /*  for  GNU CC on an Amiga                     */
00068 #include <unistd.h>   /*  for  SEEK_END                               */
00069 #endif
00070 #endif
00071 #ifndef SEEK_END      /* SEEK_END not yet defined (such as for        */
00072                       /* GNU CC 2.1 for an i386 MS-DOS computer)?     */                            
00073 #endif
00074 
00075 
00076 
00077 /***********************************************************************
00078 * Predefine the desired precision for floating point arithmetic:       *
00079 * If the macro FLOAT has been defined, we compute in single precision  *
00080 * (data type float), for LDOUBLE we compute in maximal precision       *
00081 * (data type long double), otherwise we use double precision (data type*
00082 * double). LDOUBLE only adds precision on those compilers for which    *
00083 * long double is different from double such as on Turbo C, but not on  *
00084 * QuickC compilers for example.                                        *
00085 * For input and output of floating numbers the macros LZS (length      *
00086 * prefix for scanf()) and LZP (length prefix for printf()) should be   *
00087 * used (obviously two different ones), since according to the ANSI C   *
00088 * Standard the output of double values should be done without the      *
00089 * length declaration "l" in contrast to the input where this "l" is    *
00090 * needed.                                                              *
00091 * NOTE:    If the compiler used does not know the macros FLT_MAX,      *
00092 * ====     LDBL_MAX, DBL_MAX or FLT_MAX_EXP, LDBL_MAX_EXP, DBL_MAX_EXP *
00093 *          (which can usually be found in float.h), the user must      *
00094 *          insert suitable values at the locations marked with !!!!.   *
00095 ***********************************************************************/
00096 
00097 #ifdef FLOAT                     /* single precision ? ...............*/
00098 
00099 typedef float     REAL;          /* Standard floating point type float*/
00100 /*.IX{REAL}*/
00101 typedef double    LONG_REAL;     /* more precise floating point type  */
00102 /*.IX{LONG\unt REAL}*/
00103 
00104 #ifdef FLT_EPSILON               /* ANSI C compiler ? ................*/
00105 #define MACH_EPS  (REAL)FLT_EPSILON
00106 /*.IX{MACH\unt EPS}*/
00107 #else                            /* not an ANSI C compiler ? .........*/
00108 #define MACH_EPS  mach_eps()     /* machine constant .................*/
00109 #endif
00110 
00111 #ifdef FLT_MAX_EXP               /* ANSI C compiler? .................*/
00112 #define MAX_EXP   FLT_MAX_EXP    /* Binary exponent of POSMAX ........*/
00113 /*.IX{MAX\unt EXP}*/
00114 #else                            /* not an ANSI C compiler ? .........*/
00115 #define MAX_EXP   128            /* make adjustments here !!!! .......*/
00116 #endif
00117 
00118 #ifdef FLT_MAX                   /* ANSI C compiler? ................ */
00119 #define POSMAX    (REAL)FLT_MAX  /* largest floating point number ... */
00120 /*.IX{POS\unt MAX}*/
00121 #else                            /* not an ANSI C compiler ? ........ */
00122 #define POSMAX    1e38f          /* adjust here !!!! ................ */
00123 #endif
00124 
00125 #ifdef FLT_MIN                   /* ANSI C compiler? .................*/
00126 #define POSMIN    (REAL)FLT_MIN  /* smallest positive floating point  */
00127 /*.IX{POS\unt MIN}*/
00128                                  /* number ...........................*/
00129 #else                            /* not an ANSI C compiler ? .........*/
00130 #define POSMIN    posmin()
00131 #endif
00132 
00133 #define LZS       ""             /* length prefix for formatted       */
00134 /*.IX{LZS}*/
00135                                  /* input of floating point numbers ..*/
00136 #define LZP       ""             /* length prefix for formatted       */
00137 /*.IX{LZP}*/
00138                                  /* output of floating point numbers .*/
00139 
00140 
00141 #else
00142 #ifdef LDOUBLE                   /* maximal precision ? ..............*/
00143 
00144 typedef long double  REAL;       /* Standard floating point type      */
00145                                  /* long double                       */
00146 /*.IX{REAL}*/
00147 typedef long double  LONG_REAL;  /* "more precise" floating point type*/
00148 /*.IX{LONG\unt REAL}*/
00149 #define LONG_DOUBLE_USED
00150 
00151 #ifdef LDBL_EPSILON              /* ANSI C compiler? .................*/
00152 #define MACH_EPS  (REAL)LDBL_EPSILON
00153 /*.IX{MACH\unt EPS}*/
00154 #else                            /* not an ANSI C compiler ? .........*/
00155 #define MACH_EPS  mach_eps()     /* machine constant .................*/
00156 #endif
00157 
00158 #ifdef LDBL_MAX_EXP              /* ANSI C compiler? .................*/
00159 #define MAX_EXP   LDBL_MAX_EXP   /* Binary exponent of POSMAX ........*/
00160 /*.IX{MAX\unt EXP}*/
00161 #else                            /* not an ANSI C compiler ? .........*/
00162 #define MAX_EXP   1023           /* adjust here !!!! .................*/
00163 #endif
00164 
00165 #ifdef LDBL_MAX                  /* ANSI C compiler? .................*/
00166 #define POSMAX    (REAL)LDBL_MAX /* largest floating point number ....*/
00167 /*.IX{POS\unt MAX}*/
00168 #else                            /* not an ANSI C compiler ? .........*/
00169 #define POSMAX    1e100l         /* adjust here !!!! .................*/
00170 #endif
00171 
00172 #ifdef LDBL_MIN                  /* ANSI C compiler? .................*/
00173 #define POSMIN    (REAL)LDBL_MIN /* smallest positive floating point  */
00174 /*.IX{POS\unt MIN}*/                /* number ...........................*/
00175 #else                            /* not an  ANSI C compiler ? ........*/
00176 #define POSMIN    posmin()
00177 #endif
00178 
00179 #define LZS       "L"            /* length prefix for formatted       */
00180 /*.IX{LZS}*/
00181                                  /* input of floating point numbers ..*/
00182 #define LZP       "L"            /* length prefix for formatted       */
00183 /*.IX{LZP}*/
00184                                  /* output of floating point numbers .*/
00185 
00186 
00187 #else                            /* double precision ? ...............*/
00188 
00189 typedef double       REAL;       /* Standard floating point type      */
00190                                  /* double                            */
00191 /*.IX{REAL}*/
00192 typedef long double  LONG_REAL;  /* more precise floating point type  */
00193 /*.IX{LONG\unt REAL}*/
00194 
00195 #ifdef DBL_EPSILON               /* ANSI C compiler? .................*/
00196 #define MACH_EPS  (REAL)DBL_EPSILON
00197 /*.IX{MACH\unt EPS}*/
00198 #else                            /* not an ANSI C compiler ? .........*/
00199 #define MACH_EPS  mach_eps()     /* machine constant .................*/
00200 #endif
00201 
00202 #ifdef DBL_MAX_EXP               /* ANSI C compiler? .................*/
00203 #define MAX_EXP   DBL_MAX_EXP    /* Binary exponent of POSMAX ........*/
00204 /*.IX{MAX\unt EXP}*/
00205 #else                            /* not an ANSI C compiler ? .........*/
00206 #define MAX_EXP   1023           /* adjust here !!!! .................*/
00207 #endif
00208 
00209 #ifdef DBL_MAX                   /* ANSI C compiler? .................*/
00210 #define POSMAX    (REAL)DBL_MAX  /* largest floating point number ....*/
00211 /*.IX{POS\unt MAX}*/
00212 #else                            /* not an ANSI C compiler ? .........*/
00213 #define POSMAX    1e100          /* adjust here !!!! .................*/
00214 #endif
00215 
00216 #ifdef DBL_MIN                   /* ANSI C compiler? .................*/
00217 #ifdef __BORLANDC__
00218 #if __BORLANDC__ <= 0x0200       /* Borland C++ 2.0 for DOS? .........*/
00219                                            /* because the value       */
00220 #define POSMIN    2.2250738585072017E-308  /* 2.2250738585072014E-308 */
00221 #else                                      /* from `float.h' is       */
00222                                            /* regarded as zero!       */
00223 #define POSMIN    DBL_MIN        /* smallest positive floating point  */
00224 #endif                           /* number ...........................*/
00225 #else
00226 #define POSMIN    DBL_MIN        /* smallest positive floating point  */
00227 #endif
00228 /*.IX{POS\unt MIN}*/                /* number ...........................*/
00229 #else                            /* not an ANSI C compiler ? .........*/
00230 #define POSMIN    posmin()
00231 #endif
00232 
00233 #define LZS       "l"            /* length prefix for formatted       */
00234 /*.IX{LZS}*/
00235                                  /* input of floating point numbers ..*/
00236 #define LZP       ""             /* length prefix for formatted       */
00237 /*.IX{LZP}*/
00238                                  /* output of floating point numbers .*/
00239 #endif
00240 #endif
00241 
00242 
00243 
00244 /***********************************************************************
00245 * declare several important data types                                 *
00246 ***********************************************************************/
00247 
00248 #undef boolean
00249 #undef FALSE
00250 #undef TRUE
00251 typedef enum {FALSE, TRUE} boolean;
00252 /*.IX{FALSE}*/
00253 /*.IX{TRUE}*/
00254 /*.IX{boolean}*/
00255 
00256 /* function pointer types for approximation in chapter 8 .............*/
00257 typedef REAL (*ansatzfnk) (int i, REAL x);
00258 /*.IX{ansatzfnk}*/
00259 typedef REAL (*approxfnk) (REAL c[], REAL x);
00260 /*.IX{approxfnk}*/
00261 typedef void (*ableitfnk) (REAL x, REAL c[], REAL *d);
00262 /*.IX{ableitfnk}*/
00263 
00264 /* Type of function, which evaluates the right hand side of an .......*/
00265 /* explicit ordinary differential equation  y' = f(x,y)        .......*/
00266 typedef REAL (*dglfnk)(REAL x, REAL y);
00267 /*.IX{dglfnk}*/
00268 
00269 
00270 /* Type of function, which evaluates the right hand side .............*/
00271 /* of a system of differential equations  y' = f(x,y)    .............*/
00272 typedef void (*dglsysfnk)(REAL x, REAL y[], REAL f[]);
00273 /*.IX{dglsysfnk}*/
00274 
00275 /* Type of function, which computes the boundary value r(ya, yb) .....*/
00276 /* of a two-point first order boundary value problem             .....*/
00277 typedef void (*rndbedfnk)(REAL ya[], REAL yb[], REAL r[]);
00278 /*.IX{rndbedfnk}*/
00279 
00280 /* enumeration type for classification of error codes that are  ......*/
00281 /* returned from most of the functions that realize a numerical ......*/
00282 /* method                                                       ......*/
00283 typedef enum { KEIN_FEHLER, WARNUNG, UNBEKANNT, FATAL } fehler_t;
00284 /*.IX{KEIN\unt FEHLER}*/
00285 /*.IX{WARNUNG}*/
00286 /*.IX{UNBEKANNT}*/
00287 /*.IX{FATAL}*/
00288 /*.IX{fehler\unt t}*/
00289 
00290 typedef REAL abl_mat1[4][2];     /* used to evaluate splinefunctions  */
00291 /*.IX{abl\unt mat1}*/
00292 typedef REAL abl_mat2[6][2];     /* in spliwert ......................*/
00293 /*.IX{abl\unt mat2}*/
00294 
00295 typedef REAL mat4x4[4][4];       /* type for bicubic splines          */
00296 
00297 /*--------------------------------------------------------------------*
00298  * Type declarations by Albert Becker                                 *
00299  *--------------------------------------------------------------------*/
00300 
00301  /* Real functions ...................................................*/
00302  typedef REAL (* REALFCT)  (REAL);
00303 /*.IX{REALFCT}*/
00304 
00305  /* Real multi-dimensional functions .................................*/
00306  typedef int (* FNFCT)  (int, REAL [], REAL []);
00307 /*.IX{FNFCT}*/
00308 
00309  /* Functions for finding the Jacobi matrix ..........................*/
00310  typedef int (* JACOFCT)  (int, REAL [], REAL * []);
00311 /*.IX{JACOFCT}*/
00312 
00313 
00314 
00315 /***********************************************************************
00316 * define sevaral important macros                                      *
00317 * NOTE:    Borland C++ offers floating point standard functions        *
00318 *          suitable for long double type from version 3.0 on such as   *
00319 *          expl() instead of exp(), sinl() instead of sin() etc. But   *
00320 *          Borland C++ 3.0 does not seem to define a macro that lets   *
00321 *          the user differentiate it from  Borland C++ 2.0 and below,  *
00322 *          the user is forced to do so himself: If using Borland C++   *
00323 *          3.0 and long double the user should define the macro BC3    *
00324 *          before compiling. Only in this case will the new maximally  *
00325 *          precise floating point functions be used.                   *
00326 ***********************************************************************/
00327 
00328 #define BASIS     2               /* Basis of number representation   */
00329 /*.IX{BASIS}*/
00330 #define EPSROOT   epsroot()       /* square root of MACH_EPS          */
00331 /*.IX{EPSROOT}*/
00332 #define EPSQUAD   epsquad()       /* square of MACH_EPS               */
00333 /*.IX{EPSQUAD}*/
00334 #define MAXROOT   maxroot()       /* square root of the largest       */
00335 /*.IX{MAXROOT}*/
00336                                   /* floating point number            */
00337 #ifndef PI
00338 #define PI        pi()            /* pi = 3.14...                     */
00339 /*.IX{PI}*/
00340 #endif
00341 #define EXP_1     exp_1()         /* e = 2.71...                      */
00342 /*.IX{EXP\unt 1}*/
00343 
00344 #define ZERO      (REAL)0.0       /* declare names for recurring      */
00345 /*.IX{ZERO}*/
00346 #define ONE       (REAL)1.0       /* floating point numbers           */
00347 /*.IX{ONE}*/
00348 #define TWO       (REAL)2.0
00349 /*.IX{TWO}*/
00350 #define THREE     (REAL)3.0
00351 /*.IX{THREE}*/
00352 #define FOUR      (REAL)4.0
00353 /*.IX{FOUR}*/
00354 #define FIVE      (REAL)5.0
00355 /*.IX{FIVE}*/
00356 #define SIX       (REAL)6.0
00357 /*.IX{SIX}*/
00358 #define EIGHT     (REAL)8.0
00359 /*.IX{EIGHT}*/
00360 #define NINE      (REAL)9.0
00361 /*.IX{NINE}*/
00362 #define TEN       (REAL)10.0
00363 /*.IX{TEN}*/
00364 #define HALF      (REAL)0.5
00365 /*.IX{HALF}*/
00366 
00367 #ifdef __BORLANDC__
00368 #if __BORLANDC__ >= 0x0400          /* a BC distinguishable from BC2  */
00369                                     /* and with long double functions */
00370                                     /* (at least Borland C++ 3.1 or   */
00371                                     /* Borland C++ 1.00 for OS/2)?    */
00372 #define BC3                         /* define `BC3' automatically     */
00373 #endif
00374 #endif
00375 
00376 #ifdef _MSC_VER
00377 #if _MSC_VER     >= 0x0258          /* a MC distinguishable from QC2  */
00378                                     /* and with long double functions */
00379                                     /* (at least Microsoft C 6.00A)?  */
00380 #define MC6                         /* define MC6 automatically       */
00381 #endif
00382 #endif
00383 
00384 #if defined(LDOUBLE) &&                     /* Borland C++ 3.0 or    */\
00385     (defined(BC3) || defined(MC6) ||        /* Microsoft C 6.0 or    */\
00386      defined(EMX09B))                       /* emx 0.9b (GCC272) with */
00387                                             /* maximal precision?     */
00388 #define FABS(x)    fabsl((x))               /* use the long double    */
00389 /*.IX{FABS}*/
00390 #define SQRT(x)    sqrtl((x))               /* versions of the basic  */
00391 /*.IX{SQRT}*/
00392 #define POW(x, y)  powl((x), (y))           /* floating point         */
00393 /*.IX{POW}*/
00394 #define SIN(x)     sinl((x))                /* functions              */
00395 /*.IX{SIN}*/
00396 #define COS(x)     cosl((x))
00397 /*.IX{COS}*/
00398 #define EXP(x)     expl((x))
00399 /*.IX{EXP}*/
00400 #define LOG(x)     logl((x))
00401 /*.IX{LOG}*/
00402 #define ATAN(x)    atanl((x))
00403 /*.IX{ATAN}*/
00404 #define ACOS(x)    acosl((x))
00405 /*.IX{ACOS}*/
00406 #define COSH(x)    coshl((x))
00407 /*.IX{COSH}*/
00408 
00409 #else                                       /* less precision or not a*/
00410                                             /* BC3 and not a MC6 ?    */
00411 #define FABS(x)    (REAL)fabs((double)(x))  /* declare names of basic */
00412 #ifdef LONG_DOUBLE_USED                     /* floating point         */
00413 #define SQRT(x)    sqrtlong((x))            /* functions that can be  */
00414 /*.IX{SQRT}*/
00415 #else                                       /* used in each of the    */
00416 #define SQRT(x)    (REAL)sqrt((double)(x))  /* three precisions       */
00417 #endif
00418 #define POW(x, y)  (REAL)pow((double)(x), \
00419 /*.IX{POW}*/                              \
00420                              (double)(y))
00421 #define SIN(x)     (REAL)sin((double)(x))
00422 /*.IX{SIN}*/
00423 #define COS(x)     (REAL)cos((double)(x))
00424 /*.IX{COS}*/
00425 #define EXP(x)     (REAL)exp((double)(x))
00426 /*.IX{EXP}*/
00427 #define LOG(x)     (REAL)log((double)(x))
00428 /*.IX{LOG}*/
00429 #define ATAN(x)    (REAL)atan((double)(x))
00430 /*.IX{ATAN}*/
00431 #define ACOS(x)    (REAL)acos((double)(x))
00432 /*.IX{ACOS}*/
00433 #define COSH(x)    (REAL)cosh((double)(x))
00434 /*.IX{COSH}*/
00435 #endif
00436 
00437 #undef sign
00438 #undef min
00439 #undef max
00440 #define sign(x, y) (((y) < ZERO) ? -FABS(x) :     /* |x| times     */  \
00441 /*.IX{sign}*/                                                          \
00442                                     FABS(x))      /* sign of y     */
00443 #define min(a, b)        (((a) < (b)) ? (a) : (b))
00444 /*.IX{min}*/
00445 #define max(a, b)        (((a) > (b)) ? (a) : (b))
00446 /*.IX{max}*/
00447 #define SWAP(typ, a, b)                    /* swap two objects of   */ \
00448 /*.IX{SWAP}*/                                                          \
00449   { typ temp; temp = a; a = b; b = temp; } /* arbitrary type        */
00450 
00451 /* ------------------ Macros by Albert Becker ----------------------- */
00452 #define ABS(X) (((X) >= ZERO) ? (X) : -(X))    /* Absolute value of X */
00453 /*.IX{ABS}*/
00454 #define SIGN(X,Y) \
00455 /*.IX{SIGN}*/     \
00456              (((Y) < ZERO) ? -ABS(X) : ABS(X))    /* sign of Y times  */
00457                                                   /* ABS(X)           */
00458 #define SQR(X) ((X) * (X))                     /* square of X         */
00459 /*.IX{SQR}*/
00460 
00461 #define FORMAT_IN      "%lg"               /* Input format for  REAL  */
00462 /*.IX{FORMAT\unt IN}*/
00463 #define FORMAT_LF      "% "LZP"f "         /* Format l for  REAL      */
00464 /*.IX{FORMAT\unt LF}*/
00465 #define FORMAT_126LF   "% 12.6"LZP"f "     /* Format 12.6f for  REAL  */
00466 /*.IX{FORMAT\unt 126LF}*/
00467 #define FORMAT_2010LF  "% 20.10"LZP"f "    /* Format 20.10f for  REAL */
00468 /*.IX{FORMAT\unt 2010LF}*/
00469 #define FORMAT_2016LF  "% 20.16"LZP"f "    /* Format 20.16f for REAL  */
00470 /*.IX{FORMAT\unt 2016LF}*/
00471 #define FORMAT_LE      "% "LZP"e "         /* Format e for REAL       */
00472 /*.IX{FORMAT\unt LE}*/
00473 #define FORMAT_2016LE  "% 20.16"LZP"e "    /* Format 20.16e for REAL  */
00474 /*.IX{FORMAT\unt 2016LE}*/
00475 
00476 
00477 
00478 /***********************************************************************
00479 * declare all external functions defined in basis.c                    *
00480 ***********************************************************************/
00481 
00482 int basis(void);             /* find basis for number representation  */
00483 
00484 REAL mach_eps(void);         /* find machine constant                 */
00485 
00486 REAL epsroot(void);          /* find square root of machine constant  */
00487 
00488 REAL epsquad(void);          /* find square of machine constant       */
00489 
00490 REAL maxroot(void);   /* Root of the largest representable number ....*/
00491 
00492 REAL posmin(void);           /* find smallst positive floating point  */
00493                              /* number                                */
00494 
00495 REAL pi(void);               /* find  pi                              */
00496 
00497 REAL exp_1(void);            /* find e                                */
00498 
00499 REAL sqr(REAL x);            /* square a floating point number        */
00500 
00501 void fehler_melden   /* Write error messages to stdout and stderr ....*/
00502                   (
00503                    char text[],          /* error description ........*/
00504                    int  fehlernummer,    /* Number of error ..........*/
00505                    char dateiname[],     /* file with error  .........*/
00506                    int  zeilennummer     /* file name, row number ....*/
00507                   );
00508 
00509 int umleiten            /* Perhaps redirect stdin or stdout to a file */
00510             (
00511              int argc,       /* number of arguments in command line ..*/
00512              char *argv[]    /* Vector of arguments ..................*/
00513             );               /* error code ...........................*/
00514 
00515 void readln(void);             /* Skip the remainder of line in stdin */
00516 
00517 void getline          /* Read one line from stdin ....................*/
00518             (
00519              char kette[],    /* Vector with the read text ...........*/
00520              int limit        /* maximal length of kette .............*/
00521             );
00522 
00523 int intervall    /* Find the number for a value inside a partition ...*/
00524              (
00525               int n,         /* lenght of partition ..................*/
00526               REAL xwert,    /* number whose interval index is wanted */
00527               REAL x[]       /* partition ............................*/
00528              );              /* Index for xwert ......................*/
00529 
00530 REAL horner        /* Horner scheme for polynomial evaluations .......*/
00531            (
00532             int n,                         /* Polynomial degree ......*/
00533             REAL a[],                      /* Polynomial coefficients */
00534             REAL x                         /* place of evaluation ....*/
00535            );                              /* Polynomial value at x ..*/
00536 
00537 REAL norm_max      /* Find the maximum norm of a REAL vector .........*/
00538              (
00539               REAL vektor[],               /* vector .................*/
00540               int  n                       /* length of vector .......*/
00541              );                            /* Maximum norm ...........*/
00542 
00543 REAL skalprod           /* standard scalar product of two REAL vectors*/
00544         (
00545          REAL v[],                 /* 1st vector .....................*/
00546          REAL w[],                 /* 2nd vector .....................*/
00547          int  n                    /* vector length...................*/
00548         );                         /* scalar product .................*/
00549 
00550 void copy_vector        /* copy a REAL vector ........................*/
00551                 (
00552                  REAL ziel[],            /* copied vector ............*/
00553                  REAL quelle[],          /* original vector ..........*/
00554                  int  n                  /* length of vector .........*/
00555                 );
00556 
00557 
00558 /*--------------------------------------------------------------------*
00559  * Basic functions chapter 1 (by Albert Becker) ......................*
00560  *--------------------------------------------------------------------*/
00561 
00562 long double sqrtlong  (long double x);
00563 
00564 int comdiv              /* Complex division ..........................*/
00565            (
00566             REAL   ar,            /* Real part of numerator ..........*/
00567             REAL   ai,            /* Imaginary part of numerator .....*/
00568             REAL   br,            /* Real part of denominator ........*/
00569             REAL   bi,            /* Imaginary part of denominator ...*/
00570             REAL * cr,            /* Real part of quotient ...........*/
00571             REAL * ci             /* Imaginary part of quotient ......*/
00572            );
00573 
00574 REAL comabs             /* Complex absolute value ....................*/
00575               (
00576                REAL  ar,          /* Real part .......................*/
00577                REAL  ai           /* Imaginary part ..................*/
00578               );
00579 
00580 void quadsolv           /* Complex quadratic equation ................*/
00581              (
00582                REAL    ar,        /* second degree coefficient .......*/
00583                REAL    ai,
00584                REAL    br,        /* linear coefficient ..............*/
00585                REAL    bi,
00586                REAL    cr,        /* polynomial constant .............*/
00587                REAL    ci,
00588                REAL *  tr,        /* solution ........................*/
00589                REAL *  ti
00590              );
00591 
00592 void SetVec             /* initialize vector .........................*/
00593            (int n, REAL x[], REAL val);
00594 
00595 void CopyVec            /* copy vector ...............................*/
00596             (int n, REAL source[], REAL dest[]);
00597 
00598 int ReadVec             /* read vector from input index starts at zero*/
00599            (FILE *fp, int n, REAL x[]);
00600 
00601 int ReadVec1            /* read vector from input index starts at one */
00602            (FILE *fp, int n, REAL x[]);
00603 
00604 int WriteVec            /* write vector to output index starts at zero*/
00605            (FILE *fp, int n, REAL x[]);
00606 
00607 int WriteVec1           /* write vector to output index starts at one */
00608            (FILE *fp, int n, REAL x[]);
00609 
00610 void SetMat             /* initialize matrix .........................*/
00611            (int m, int n, REAL * a[], REAL val);
00612 
00613 void CopyMat            /* copy matrix ...............................*/
00614             (int m, int n, REAL * source[], REAL * dest[]);
00615 
00616 int ReadMat             /* read matrix from input index starts at zero*/
00617            (FILE *fp, int m, int n, REAL * a[]);
00618 int ReadMat1            /* read matrix from input index starts at one */
00619            (FILE *fp, int m, int n, REAL * a[]);
00620 
00621 int WriteMat            /* write matrix to output index starts at zero*/
00622             (FILE *fp, int m, int n, REAL * mat[]);
00623 int WriteMat1           /* write matrix to output index starts at one */
00624             (FILE *fp, int m, int n, REAL * mat[]);
00625 
00626 int WriteHead  (FILE *fp, char *s); /* write header to file   ........*/
00627 
00628 int WriteEnd  (FILE *fp);         /* write separator to file   .......*/
00629 
00630 void LogError           /* write error message to stdout .............*/
00631              (char *s, int rc, char *file, int line);
00632 
00633 
00634 
00635 #endif
00636 
00637 /* -------------------------- END basis.h --------------------------- */

Generated on Wed Sep 5 12:54:18 2007 for DSACSS Operational Code by  doxygen 1.3.9.1