00001
00002
00003
00004
00005 #ifndef MA57LINSYS_H
00006 #define MA57LINSYS_H
00007
00008 #include "DoubleLinearSolver.h"
00009 #include "SparseSymMatrixHandle.h"
00010 #include "SparseStorageHandle.h"
00011 #include "OoqpVectorHandle.h"
00012
00013 extern "C" {
00014 void ma57id_( double cntl[], int icntl[] );
00015
00016 void ma57ad_( int * n, int * ne, int irn[],
00017 int jcn[], int * lkeep, int keep[],
00018 int iwork[], int icntl[], int info[],
00019 double rinfo[] );
00020
00021 void ma57bd_( int * n, int * ne, double a[],
00022 double fact[], int * lfact, int ifact[],
00023 int * lifact, int * lkeep, int keep[],
00024 int ppos[], int * icntl, double cntl[],
00025 int info[], double rinfo[] );
00026 void ma57cd_( int * job, int * n, double fact[],
00027 int * lfact, int ifact[], int * lifact,
00028 int * nrhs, double rhs[], int * lrhs,
00029 double w[], int * lw, int iw1[],
00030 int icntl[], int info[]);
00031 void ma57dd_( int * job, int * n, int * ne,
00032 double a[], int irn[], int jcn[],
00033 double fact[], int * lfact, int ifact[],
00034 int * lifact, double rhs[], double x[],
00035 double resid[], double w[], int iw[],
00036 int icntl[], double cntl[], int info[],
00037 double rinfo[] );
00038 void ma57ed_( int * n, int * ic, int keep[],
00039 double fact[], int * lfact, double * newfac,
00040 int * lnew, int ifact[], int * lifact,
00041 int newifc[], int * linew, int * info );
00042 }
00043
00048 class Ma57Solver : public DoubleLinearSolver {
00049 private:
00050 Ma57Solver() {};
00051 protected:
00052 int icntl[20];
00053 int info[40];
00054 double cntl[5];
00055 double rinfo[20];
00056
00062 double kThresholdPivoting;
00063
00068 double kThresholdPivotingMax;
00069
00072 double kThresholdPivotingFactor;
00073
00078 double kTreatAsZero;
00079
00084 double kPrecision;
00085
00087 int *irowM, *jcolM;
00088
00090 double *M;
00091
00093 int n;
00094
00096 int nnz;
00097
00099 int lkeep, *keep;
00100
00102 int lifact, *ifact, lfact;
00103
00104
00105 double *fact;
00106
00110 double ipessimism, rpessimism;
00111
00115 int freshFactor;
00116
00118 SparseStorageHandle mStorage;
00119
00122 virtual void firstCall();
00123 public:
00125 Ma57Solver( SparseSymMatrix * sgm );
00126
00127 virtual void diagonalChanged( int idiag, int extent );
00128 virtual void matrixChanged();
00129 virtual void solve( OoqpVector& rhs );
00130
00133 double setTreatAsZero() { return cntl[1] = kTreatAsZero; }
00134
00137 double setThresholdPivoting() { return cntl[0] = kThresholdPivoting; }
00138
00140 virtual ~Ma57Solver();
00141 };
00142
00143 #endif