00001
00002
00003
00004
00005 #ifndef QPEXAMPLEDATA_H
00006 #define QPEXAMPLEDATA_H
00007
00008 #include "Data.h"
00009
00010 #include "DoubleMatrixHandle.h"
00011 #include "DenseSymMatrixHandle.h"
00012 #include "OoqpVectorHandle.h"
00013
00014
00015 #include "OoqpVector.h"
00016 #include "DoubleMatrix.h"
00017 class LinearAlgebraPackage;
00018
00026 class QpExampleData : public Data
00027 {
00028 protected:
00029 QpExampleData() {};
00030
00031 LinearAlgebraPackage * la;
00032
00034 int nx;
00035
00037 int my;
00038
00040 int mz;
00041
00043 SymMatrix * Q;
00044
00046 GenMatrix * A;
00047
00049 GenMatrix * C;
00050
00052 OoqpVector * c;
00053
00055 OoqpVector * b;
00056
00058 OoqpVector * d;
00059 public:
00060
00061 QpExampleData(LinearAlgebraPackage * la, int nx_in, int my_in, int mz_in);
00062 virtual ~QpExampleData();
00063
00064 virtual double datanorm();
00065
00066 virtual void datainput() { };
00067 virtual void datarandom();
00068 virtual void print();
00069
00072 void putQIntoAt( SymMatrix& M, int row, int col )
00073 {
00074 M.symAtPutSubmatrix( row, col, *Q, 0, 0, nx, nx );
00075 }
00076
00079 void putAIntoAt( SymMatrix& M, int row, int col )
00080 {
00081 M.symAtPutSubmatrix( row, col, *A, 0, 0, my, nx );
00082 }
00083
00086 void putCIntoAt( SymMatrix& M, int row, int col )
00087 {
00088 M.symAtPutSubmatrix( row, col, *C, 0, 0, mz, nx );
00089 }
00090
00092 void Qmult( double beta, OoqpVector& y,
00093 double alpha, OoqpVector& x )
00094 {
00095 Q->mult( beta, y, alpha, x );
00096 }
00097
00099 void Amult( double beta, OoqpVector& y,
00100 double alpha, OoqpVector& x)
00101 {
00102 A->mult( beta, y, alpha, x );
00103 }
00104
00106 void Cmult( double beta, OoqpVector& y,
00107 double alpha, OoqpVector& x )
00108 {
00109 C->mult( beta, y, alpha, x );
00110 }
00111
00113 void ATransmult( double beta, OoqpVector& y,
00114 double alpha, OoqpVector& x )
00115 {
00116 A->transMult( beta, y, alpha, x );
00117 }
00118
00120 void CTransmult( double beta, OoqpVector& y,
00121 double alpha, OoqpVector& x )
00122 {
00123 C->transMult( beta, y, alpha, x);
00124 }
00125
00127 void getg( OoqpVector& c_out ) { c_out.copyFrom( *c ); }
00128
00130 void getb( OoqpVector& b_out ) { b_out.copyFrom( *b ); }
00131
00133 void getd( OoqpVector& d_out ) { d_out.copyFrom( *d ); }
00134
00135 GenMatrix * getC() { IotrAddRef(&C); return C; }
00136 };
00137
00138 #endif