ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TQpDataDens.h
Go to the documentation of this file.
1 // @(#)root/quadp:$Id$
2 // Author: Eddy Offermann May 2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /*************************************************************************
13  * Parts of this file are copied from the OOQP distribution and *
14  * are subject to the following license: *
15  * *
16  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO *
17  * *
18  * The copyright holder hereby grants you royalty-free rights to use, *
19  * reproduce, prepare derivative works, and to redistribute this software*
20  * to others, provided that any changes are clearly documented. This *
21  * software was authored by: *
22  * *
23  * E. MICHAEL GERTZ gertz@mcs.anl.gov *
24  * Mathematics and Computer Science Division *
25  * Argonne National Laboratory *
26  * 9700 S. Cass Avenue *
27  * Argonne, IL 60439-4844 *
28  * *
29  * STEPHEN J. WRIGHT swright@cs.wisc.edu *
30  * Computer Sciences Department *
31  * University of Wisconsin *
32  * 1210 West Dayton Street *
33  * Madison, WI 53706 FAX: (608)262-9777 *
34  * *
35  * Any questions or comments may be directed to one of the authors. *
36  * *
37  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF *
38  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND *
39  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT *
40  * WITH THE DEPARTMENT OF ENERGY. *
41  *************************************************************************/
42 
43 #ifndef ROOT_TQpDataDens
44 #define ROOT_TQpDataDens
45 
46 #ifndef ROOT_TError
47 #include "TError.h"
48 #endif
49 #ifndef ROOT_TQpDataBase
50 #include "TQpDataBase.h"
51 #endif
52 
53 #ifndef ROOT_TQpVar
54 #include "TQpVar.h"
55 #endif
56 
57 #ifndef ROOT_TMatrixD
58 #include "TMatrixD.h"
59 #endif
60 #ifndef ROOT_TMatrixDSym
61 #include "TMatrixDSym.h"
62 #endif
63 
64 //////////////////////////////////////////////////////////////////////////
65 // //
66 // TQpDataDens //
67 // //
68 // Data for the dense QP formulation //
69 // //
70 //////////////////////////////////////////////////////////////////////////
71 
72 class TQpDataDens : public TQpDataBase
73 {
74 
75 protected:
76 
77  // these variables will be "Used" not copied
78  TMatrixDSym fQ; // Quadratic part of Objective function
79  TMatrixD fA; // Equality constraints
80  TMatrixD fC; // Inequality constraints
81 
82 public:
83 
85  // data objects of the specified dimensions
87 
88  // sets up pointers to the data objects that are passed as arguments
90  TVectorD &ixupp,TMatrixD &A,TVectorD &bA,TMatrixD &C,TVectorD &clow,
91  TVectorD &iclow,TVectorD &cupp,TVectorD &icupp);
92  TQpDataDens(const TQpDataDens &another);
93 
94  virtual ~TQpDataDens() {}
95 
96  virtual void PutQIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
97  // insert the Hessian Q into the matrix M for the fundamental
98  // linear system, where M is stored as a TMatrixD
99  virtual void PutAIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
100  // insert the constraint matrix A into the matrix M for the
101  // fundamental linear system, where M is stored as a TMatrixD
102  virtual void PutCIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
103  // insert the constraint matrix C into the matrix M for the
104  // fundamental linear system, where M is stored as a TMatrixD
105 
106  virtual void Qmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
107  // y = beta * y + alpha * Q * x
108  virtual void Amult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
109  // y = beta * y + alpha * A * x
110  virtual void Cmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
111  // y = beta * y + alpha * C * x
112  virtual void ATransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
113  // y = beta * y + alpha * A^T * x
114  virtual void CTransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
115  // y = beta * y + alpha * C^T * x
116 
117  virtual void GetDiagonalOfQ(TVectorD &dQ); // extract the diagonal of Q and put it in the vector dQ
118 
119  virtual Double_t DataNorm();
120  virtual void DataRandom(TVectorD &x,TVectorD &y,TVectorD &z,TVectorD &s);
121  // Create a random problem (x,y,z,s)
122  // the solution to the random problem
123  virtual void Print(Option_t *opt="") const;
124 
125  virtual Double_t ObjectiveValue(TQpVar *vars);
126 
127  TQpDataDens &operator= (const TQpDataDens &source);
128 
129  ClassDef(TQpDataDens,1) // Qp Data class for Dens formulation
130 };
131 #endif
const int nx
Definition: kalman.C:16
tuple row
Definition: mrt.py:26
virtual void Qmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fQ*x)
virtual void Print(Option_t *opt="") const
Print all class members.
virtual void PutQIntoAt(TMatrixDBase &M, Int_t row, Int_t col)
Insert the Hessian Q into the matrix M at index (row,col) for the fundamental linear system...
return c
const char Option_t
Definition: RtypesCore.h:62
int Int_t
Definition: RtypesCore.h:41
TMatrixD fC
Definition: TQpDataDens.h:80
static double A[]
double beta(double x, double y)
Calculates the beta function.
virtual void Cmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fC*x)
virtual void PutCIntoAt(TMatrixDBase &M, Int_t row, Int_t col)
Insert the constraint matrix C into the matrix M at index (row,col) for the fundamental linear system...
TMatrixDSym fQ
Definition: TQpDataDens.h:78
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void Amult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fA*x)
virtual Double_t ObjectiveValue(TQpVar *vars)
Return value of the objective function.
Float_t z[5]
Definition: Ifit.C:16
TMatrixD fA
Definition: TQpDataDens.h:79
virtual void CTransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fC^T*x)
virtual ~TQpDataDens()
Definition: TQpDataDens.h:94
virtual void PutAIntoAt(TMatrixDBase &M, Int_t row, Int_t col)
Insert the constraint matrix A into the matrix M at index (row,col) for the fundamental linear system...
virtual void DataRandom(TVectorD &x, TVectorD &y, TVectorD &z, TVectorD &s)
Choose randomly a QP problem.
TQpDataDens & operator=(const TQpDataDens &source)
Assignment operator.
static double C[]
virtual void GetDiagonalOfQ(TVectorD &dQ)
Return in vector dq the diagonal of matrix fQ (Quadratic part of Objective function) ...
virtual void ATransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fA^T*x)
double Double_t
Definition: RtypesCore.h:55
virtual Double_t DataNorm()
Return the largest component of several vectors in the data class.
Double_t y[n]
Definition: legend1.C:17
Definition: TQpVar.h:65
static double Q[]