00001
00002
00003
00004
00005 #ifndef Midnight_h
00006 #define Midnight_h
00007
00008
00009 typedef unsigned char MBool;
00010 typedef int MInt;
00011 typedef double MDouble;
00012 typedef void(*MFunction)(MInt&,MDouble*,MDouble&,MDouble*,MInt);
00013 typedef void(*MPrintf)(const char*,...);
00014
00015 class Midnight {
00016 public:
00017
00018
00019
00020
00021 class MString {
00022 public:
00023 MString();
00024 MString(const char*);
00025 MString(const MString&);
00026 ~MString();
00027 const char* data() const;
00028 int length() const;
00029 void resize(int);
00030 MString& replace(int,int,const MString&);
00031 MString& operator +=(const char*);
00032 MString& operator +=(const MString&);
00033 MString& operator =(const char*);
00034 MString& operator =(const MString&);
00035 MString& operator =(char);
00036 operator const char*() const;
00037 char& operator[](int);
00038 char operator[](int) const;
00039 char& operator()(int);
00040 char operator()(int) const;
00041 MString operator()(int,int);
00042 friend int operator ==(const MString&,const MString&);
00043 friend int operator !=(const MString&,const MString&);
00044 friend int operator ==(const MString&,const char*);
00045 friend int operator !=(const MString&,const char*);
00046 private:
00047 char* fString;
00048 };
00049 private:
00050 MInt fEmpty;
00051 MInt fMaxpar;
00052 MString *fCpnam;
00053 MDouble *fU;
00054 MDouble *fAlim;
00055 MDouble *fBlim;
00056 MDouble *fErp;
00057 MDouble *fErn;
00058 MDouble *fWerr;
00059 MDouble *fGlobcc;
00060 MInt *fNvarl;
00061 MInt *fNiofex;
00062 MInt *fNexofi;
00063 MDouble *fX;
00064 MDouble *fXt;
00065 MDouble *fDirin;
00066 MDouble *fXs;
00067 MDouble *fXts;
00068 MDouble *fDirins;
00069 MDouble *fGrd;
00070 MDouble *fG2;
00071 MDouble *fGstep;
00072 MDouble *fGin;
00073 MDouble *fDgrd;
00074 MDouble *fGrds;
00075 MDouble *fG2s;
00076 MDouble *fGsteps;
00077 MInt *fIpfix;
00078 MInt fNpfix;
00079 MDouble *fVhmat;
00080 MDouble *fVthmat;
00081 MDouble *fP;
00082 MDouble *fPstar;
00083 MDouble *fPstst;
00084 MDouble *fPbar;
00085 MDouble *fPrho;
00086 MInt fMaxint;
00087 MInt fNpar;
00088 MInt fMaxext;
00089 MInt fNu;
00090 MInt fIsysrd;
00091 MInt fIsyswr;
00092 MInt fIsyssa;
00093 MInt fNpagwd;
00094 MInt fNpagln;
00095 MInt fNewpag;
00096 MInt fIstkrd[10];
00097 MInt fNstkrd;
00098 MInt fIstkwr[10];
00099 MInt fNstkwr;
00100 MString fCfrom;
00101 MString fCstatu;
00102 MString fCtitl;
00103 MString fCword;
00104 MString fCundef;
00105 MString fCvrsn;
00106 MString fCovmes[4];
00107 MInt fISW[7];
00108 MInt fIdbg[11];
00109 MInt fNblock;
00110 MInt fIcomnd;
00111 MDouble fAmin;
00112 MDouble fUp;
00113 MDouble fEDM;
00114 MDouble fFval3;
00115 MDouble fEpsi;
00116 MDouble fApsi;
00117 MDouble fDcovar;
00118 MInt fNfcn;
00119 MInt fNfcnmx;
00120 MInt fNfcnlc;
00121 MInt fNfcnfr;
00122 MInt fItaur;
00123 MInt fIstrat;
00124 MInt fNwrmes[2];
00125 MDouble *fWord7;
00126 MBool fLwarn;
00127 MBool fLrepor;
00128 MBool fLimset;
00129 MBool fLnolim;
00130 MBool fLnewmn;
00131 MBool fLphead;
00132 MDouble fEpsmac;
00133 MDouble fEpsma2;
00134 MDouble fVlimlo;
00135 MDouble fVlimhi;
00136 MDouble fUndefi;
00137 MDouble fBigedm;
00138 MDouble fUpdflt;
00139 MDouble *fXpt;
00140 MDouble *fYpt;
00141 MString *fChpt;
00142 MDouble fXmidcr;
00143 MDouble fYmidcr;
00144 MDouble fXdircr;
00145 MDouble fYdircr;
00146 MInt fKe1cr;
00147 MInt fKe2cr;
00148 MString *fOrigin;
00149 MString *fWarmes;
00150 MInt fNfcwar[20];
00151 MInt fIcirc[2];
00152 MFunction fFCN;
00153 MPrintf fPrintf;
00154
00155
00156
00157 private:
00158 Midnight(const Midnight &m);
00159 void BuildArrays(MInt maxpar=15);
00160 void DeleteArrays();
00161 public:
00162 Midnight();
00163 Midnight(MInt maxpar);
00164 virtual ~Midnight();
00165 void SetFCN(MFunction);
00166 void SetPrintf(MPrintf);
00167
00168
00169
00170 int GetParameter(int parNo, double ¤tValue, double ¤tError );
00171
00172
00173 void mnamin();
00174 void mnbins(MDouble a1, MDouble a2, MInt naa, MDouble &bl, MDouble &bh, MInt &nb, MDouble &bwid);
00175 void mncalf(MDouble *pvec, MDouble &ycalf);
00176 void mncler();
00177 void mncntr(MInt ke1, MInt ke2, MInt &ierrf);
00178 void mncomd(MString crdbin, MInt &icondn);
00179 void mncont(MInt ke1, MInt ke2, MInt nptu, MDouble *xptu, MDouble *yptu, MInt &ierrf);
00180 void mncrck(MString &crdbuf, MInt maxcwd, MString &comand, MInt &lnc
00181 , MInt mxp, MDouble *plist, MInt &llist, MInt &ierr, MInt isyswr);
00182 void mncros(MDouble &aopt, MInt &iercr);
00183 void mncuve();
00184 void mnderi();
00185 void mndxdi(MDouble pint, MInt ipar, MDouble &dxdi);
00186 void mneig(MDouble *a, MInt ndima, MInt n, MInt mits, MDouble *work, MDouble precis, MInt &ifault);
00187 void mnemat(MDouble *emat, MInt ndim);
00188 void mnerrs(MInt number, MDouble &eplus, MDouble &eminus, MDouble &eparab, MDouble &gcc);
00189 void mneval(MDouble anext, MDouble &fnext, MInt &ierev);
00190 void mnexcm(MString comand, MDouble *plist, MInt llist, MInt &ierflg) ;
00191 void mnexin(MDouble *pint);
00192 void mnfixp(MInt iint, MInt &ierr);
00193 void mnfree(MInt k);
00194 void mngrad();
00195 void mnhelp(MString comd);
00196 void mnhess();
00197 void mnhes1();
00198 void mnimpr();
00199 void mninex(MDouble *pint);
00200 void mninit(MInt i1, MInt i2, MInt i3);
00201 void mnlims();
00202 void mnline(MDouble *start, MDouble fstart, MDouble *step, MDouble slope, MDouble toler);
00203 void mnmatu(MInt kode);
00204 void mnmigr();
00205 void mnmnos();
00206 void mnmnot(MInt ilax, MInt ilax2, MDouble &val2pl, MDouble &val2mi);
00207 void mnparm(MInt k, MString cnamj, MDouble uk, MDouble wk, MDouble a, MDouble b, MInt &ierflg);
00208 void mnpars(MString &crdbuf, MInt &icondn);
00209 void mnpfit(MDouble *parx2p, MDouble *pary2p, MInt npar2p, MDouble *coef2p, MDouble &sdev2p);
00210 void mnpint(MDouble &pexti, MInt i, MDouble &pinti);
00211 void mnplot(MDouble *xpt, MDouble *ypt, MString *chpt, MInt nxypt, MInt npagwd, MInt npagln);
00212 void mnpout(MInt iuext, MString& chnam, MDouble &val, MDouble &err, MDouble &xlolim, MDouble &xuplim, MInt &iuint);
00213 void mnprin(MInt inkode, MDouble fval);
00214 void mnpsdf();
00215 void mnrazz(MDouble ynew, MDouble *pnew, MDouble *y, MInt &jh, MInt &jl);
00216 void mnrn15(MDouble &val, MInt &inseed);
00217 void mnrset(MInt iopt);
00218 void mnsave();
00219 void mnscan();
00220 void mnseek();
00221 void mnset();
00222 void mnsimp();
00223 void mnstat(MDouble &fmin, MDouble &fedm, MDouble &errdef, MInt &npari, MInt &nparx, MInt &istat);
00224 void mntiny(MDouble epsp1, MDouble &epsbak);
00225 MBool mnunpt(MString &cfname);
00226 void mnvert(MDouble *a, MInt l, MInt m, MInt n, MInt &ifail);
00227 void mnwarn(const char *copt, const char *corg, const char *cmes);
00228 void mnwerr();
00229 };
00230
00231 #endif
00232
00233
00234
00235
00236
00237
00238
00239