Logo ROOT   6.13/01
Reference Guide
TQpDataSparse.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_TQpDataSparse
44 #define ROOT_TQpDataSparse
45 
46 #include "TQpDataBase.h"
47 #include "TQpVar.h"
48 
49 #include "TMatrixDSparse.h"
50 
51 //////////////////////////////////////////////////////////////////////////
52 // //
53 // TQpDataSparse //
54 // //
55 // Data for the dense QP formulation //
56 // //
57 //////////////////////////////////////////////////////////////////////////
58 
59 class TQpDataSparse : public TQpDataBase
60 {
61 
62 protected:
63 
64  // these variables will be "Used" not copied
65  TMatrixDSparse fQ; // quadratic part of Objective function
66  TMatrixDSparse fA; // Equality constraints
67  TMatrixDSparse fC; // Inequality constraints
68 
69 public:
70 
72  // data objects of the specified dimensions
73  TQpDataSparse(Int_t nx,Int_t my,Int_t mz);
74 
75  // sets up pointers to the data objects that are passed as arguments
78  TVectorD &iclow,TVectorD &cupp,TVectorD &icupp);
79  TQpDataSparse(const TQpDataSparse &another);
80 
81  virtual ~TQpDataSparse() {}
82 
83  void SetNonZeros(Int_t nnzQ,Int_t nnzA,Int_t nnzC);
84 
85  virtual void PutQIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
86  // insert the Hessian Q into the matrix M for the fundamental
87  // linear system, where M is stored as a TMatrixDSparse
88  virtual void PutAIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
89  // insert the constraint matrix A into the matrix M for the
90  // fundamental linear system, where M is stored as a TMatrixDSparse
91  virtual void PutCIntoAt(TMatrixDBase &M,Int_t row,Int_t col);
92  // insert the constraint matrix C into the matrix M for the
93  // fundamental linear system, where M is stored as a
94  // TMatrixDSparse
95 
96  virtual void Qmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
97  // y = beta * y + alpha * Q * x
98  virtual void Amult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
99  // y = beta * y + alpha * A * x
100  virtual void Cmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
101  // y = beta * y + alpha * C * x
102  virtual void ATransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
103  // y = beta * y + alpha * A^T * x
104  virtual void CTransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x);
105  // y = beta * y + alpha * C^T * x
106 
107  virtual void GetDiagonalOfQ(TVectorD &dQ); // extract the diagonal of Q and put it in the vector dQ
108 
109  virtual Double_t DataNorm();
110  virtual void DataRandom(TVectorD &x,TVectorD &y,TVectorD &z,TVectorD &s);
111  // Create a random problem (x,y,z,s)
112  // the solution to the random problem
113  virtual void Print(Option_t *opt="") const;
114 
115  virtual Double_t ObjectiveValue(TQpVar *vars);
116 
117  TQpDataSparse &operator= (const TQpDataSparse &source);
118 
119  ClassDef(TQpDataSparse,1) // Qp Data class for Sparse formulation
120 };
121 #endif
virtual void Print(Option_t *opt="") const
Print 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...
TMatrixDSparse fQ
Definition: TQpDataSparse.h:65
you should not use this method at all Int_t y
Definition: TRolke.cxx:630
TMatrixDSparse fC
Definition: TQpDataSparse.h:67
static double A[]
virtual void ATransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fA^T*x)
double beta(double x, double y)
Calculates the beta function.
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...
virtual void DataRandom(TVectorD &x, TVectorD &y, TVectorD &z, TVectorD &s)
Choose randomly a QP problem.
virtual ~TQpDataSparse()
Definition: TQpDataSparse.h:81
void SetNonZeros(Int_t nnzQ, Int_t nnzA, Int_t nnzC)
Allocate space for the appropriate number of non-zeros in the matrices.
static double C[]
virtual Double_t ObjectiveValue(TQpVar *vars)
Return value of the objective function.
virtual Double_t DataNorm()
Return the largest component of several vectors in the data class.
virtual void Amult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fA*x)
Linear Algebra Package.
* x
Deprecated and error prone model selection interface.
Definition: TRolke.cxx:630
virtual void CTransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fC^T*x)
TMatrixDSparse fA
Definition: TQpDataSparse.h:66
virtual void GetDiagonalOfQ(TVectorD &dQ)
Return in vector dq the diagonal of matrix fQ.
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
TQpDataSparse & operator=(const TQpDataSparse &source)
Assignment operator.
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...
Definition: TQpVar.h:59
virtual void Qmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fQ*x)
static double Q[]
virtual void Cmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)
calculate y = beta*y + alpha*(fC*x)