00001
00002
00003
00004
00005 #ifndef MA27LINSYS_H
00006 #define MA27LINSYS_H
00007
00008 #include "DoubleLinearSolver.h"
00009 #include "SparseSymMatrixHandle.h"
00010 #include "SparseStorageHandle.h"
00011 #include "OoqpVectorHandle.h"
00012
00013
00014
00015 extern "C" {
00016 void ma27id_( int icntl[], double cntl[] );
00017
00018 void ma27ad_( int * n, int * nz,
00019 int irn[], int icn[],
00020 int iw[], int * liw,
00021 int ikeep[], int iw1[],
00022 int * nsteps, int * iflag,
00023 int icntl[], double cntl[],
00024 int info[], double * ops );
00025
00026 void ma27bd_( int * n, int * nz,
00027 int irn[], int icn[],
00028 double a[], int * la,
00029 int iw[], int * liw,
00030 int ikeep[], int * nsteps,
00031 int * maxfrt, int iw1[],
00032 int icntl[], double cntl[],
00033 int info[] );
00034
00035 void ma27cd_( int * n,
00036 double a[], int * la,
00037 int iw[], int * liw,
00038 double w[], int * maxfrt,
00039 double rhs[],
00040 int iw2[], int * nsteps,
00041 int icntl[], int info[] );
00042 }
00043
00048 class Ma27SolverBase : public DoubleLinearSolver {
00049 protected:
00050 Ma27SolverBase() {};
00051 protected:
00052 int icntl[30];
00053 int info[20];
00054 double cntl[5];
00055
00056
00059 int ierror() { return info[1]; }
00060 int minimumRealWorkspace() { return info[4]; }
00061 int minimumIntWorkspace() { return info[5]; }
00062 int ma27ErrFlg() { return info[0]; }
00063
00068 double precision;
00069
00071 int *irowM, *jcolM;
00072
00074 double *fact;
00075
00077 int n;
00078
00080 int nnz;
00081
00085 int la;
00086
00088 int *ikeep, *iw, liw, *iw1, *iw2, nsteps, maxfrt;
00089
00091 double *w;
00092
00096 double ipessimism, rpessimism;
00097
00100 virtual void firstCall();
00101 public:
00102
00106 Ma27SolverBase( int n, int nnz );
00107
00113 double thresholdPivoting() { return cntl[0]; }
00114 void setThresholdPivoting( double piv ) { cntl[0] = piv; }
00115
00120 double treatAsZero() { return cntl[2]; }
00121 void setTreatAsZero( double tol ) { cntl[2] = tol; }
00122
00125 virtual void copyMatrixElements( double fact[], int lfact ) = 0;
00126
00135 virtual void getIndices( int irowM[], int jcolM[] ) = 0;
00136
00137 virtual void diagonalChanged( int idiag, int extent );
00138 virtual void matrixChanged();
00139
00148 virtual void basicSolve( double drhs[], int n );
00149
00158 virtual void solve( OoqpVector& rhs ) = 0;
00159
00161 virtual ~Ma27SolverBase();
00162 };
00163
00168 class Ma27Solver : public Ma27SolverBase {
00169 protected:
00170 Ma27Solver() {};
00171
00173 SparseSymMatrixHandle mMat;
00174
00175 public:
00177 Ma27Solver( SparseSymMatrix * sgm );
00178
00184 virtual void copyMatrixElements( double fact[], int lfact );
00185
00194 virtual void getIndices( int irowM[], int jcolM[] );
00195
00203 virtual void solve( OoqpVector& rhs );
00204 };
00205
00206 #endif
00207
00208
00209