00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef ITLIN_H
00049 #define ITLIN_H
00050
00051
00052 #define RCODE info->rcode
00053 #define MIN(A,B) ( A < B ? A : B )
00054 #define MAX(A,B) ( A > B ? A : B )
00055 #define SIGN(A) ( A > 0 ? 1 : -1 )
00056
00057 #define SMALL 1.0e-150
00058 #define EPMACH 1.0e-17
00059
00060 typedef enum {None=0, Minimum=1, Verbose=2, Debug=3} PRINT_LEVEL ;
00061 typedef enum {False=0, True=1} LOGICAL ;
00062 typedef enum { CheckOnRestart=0, CheckEachIter=1 } TERM_CHECK ;
00063 typedef enum { Absolute=0, Relative=1 } CONV_CHECK ;
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 typedef void MATVEC(int n, double* x, double* b);
00078 typedef void PRECON(int, double*, double*);
00079
00080 struct ITLIN_OPT
00081 {
00082 double tol, rho;
00083 int i_max, maxiter;
00084 TERM_CHECK termcheck;
00085 CONV_CHECK convcheck;
00086 LOGICAL rescale;
00087 PRINT_LEVEL errorlevel, monitorlevel, datalevel;
00088 FILE *errorfile, *monitorfile, *datafile,
00089 *iterfile, *resfile, *miscfile;
00090 double *scale;
00091 };
00092
00093 struct ITLIN_INFO
00094 {
00095 double precision, normdx, residuum;
00096 int iter, rcode, subcode, nomatvec, noprecon, noprecl, noprecr;
00097 };
00098
00099 struct ITLIN_DATA
00100 {
00101 double *res;
00102 double tau, t, normdx, residuum;
00103 enum { GMRES=0, GBIT=1, PCG=2 } codeid;
00104 enum {Initial=1,Intermediate=2,Solution=3,Final=4} mode;
00105 };
00106
00107 struct ITLIN_IO
00108 {
00109 FILE *errfile, *monfile, *datfile,
00110 *iterfile, *resfile, *miscfile;
00111 PRINT_LEVEL errlevel, monlevel, datlevel;
00112 };
00113
00114 #define ERRORLEVEL itlin_ioctl->errlevel
00115 #define MONITORLEVEL itlin_ioctl->monlevel
00116 #define DATALEVEL itlin_ioctl->datlevel
00117 #define ERROR itlin_ioctl->errfile
00118 #define MONITOR itlin_ioctl->monfile
00119 #define DATA itlin_ioctl->datfile
00120 #define FITER itlin_ioctl->iterfile
00121 #define FRES itlin_ioctl->resfile
00122 #define FMISC itlin_ioctl->miscfile
00123
00124 extern void daxpy_(int *n, double *alpha, double *x, int *incx,
00125 double *y, int *incy);
00126
00127
00128 int zibnum_fwalloc(int size, double **ptr, char vname[]);
00129 int zibnum_iwalloc(int size, int **ptr, char vname[]);
00130 int zibnum_pfwalloc(int size, double ***ptr, char vname[]);
00131 double zibnum_scaled_norm2(int n, double *v, double *scale);
00132 double zibnum_scaled_sprod(int n, double *v1, double *v2, double *scale);
00133 double zibnum_norm2(int n, double *v);
00134 void zibnum_scale(int n, double *v1, double *v2, double *scale);
00135 void zibnum_descale(int n, double *v1, double *v2, double *scale);
00136 void itlin_noprecon(int n, double *x, double *z);
00137 void itlin_dataout(int k, int n, double *x, struct ITLIN_DATA *data);
00138 int itlin_parcheck_and_print(int n, MATVEC *matvec,
00139 struct ITLIN_OPT *opt, int itlin_code);
00140
00141 #endif