Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TQpDataSparse.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/quadp:$Id$
0002 // Author: Eddy Offermann   May 2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 /*************************************************************************
0013  * Parts of this file are copied from the OOQP distribution and          *
0014  * are subject to the following license:                                 *
0015  *                                                                       *
0016  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO                                  *
0017  *                                                                       *
0018  * The copyright holder hereby grants you royalty-free rights to use,    *
0019  * reproduce, prepare derivative works, and to redistribute this software*
0020  * to others, provided that any changes are clearly documented. This     *
0021  * software was authored by:                                             *
0022  *                                                                       *
0023  *   E. MICHAEL GERTZ      gertz@mcs.anl.gov                             *
0024  *   Mathematics and Computer Science Division                           *
0025  *   Argonne National Laboratory                                         *
0026  *   9700 S. Cass Avenue                                                 *
0027  *   Argonne, IL 60439-4844                                              *
0028  *                                                                       *
0029  *   STEPHEN J. WRIGHT     swright@cs.wisc.edu                           *
0030  *   Computer Sciences Department                                        *
0031  *   University of Wisconsin                                             *
0032  *   1210 West Dayton Street                                             *
0033  *   Madison, WI 53706   FAX: (608)262-9777                              *
0034  *                                                                       *
0035  * Any questions or comments may be directed to one of the authors.      *
0036  *                                                                       *
0037  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF   *
0038  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND     *
0039  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT   *
0040  * WITH THE DEPARTMENT OF ENERGY.                                        *
0041  *************************************************************************/
0042 
0043 #ifndef ROOT_TQpDataSparse
0044 #define ROOT_TQpDataSparse
0045 
0046 #include "TQpDataBase.h"
0047 #include "TQpVar.h"
0048 
0049 #include "TMatrixDSparse.h"
0050 
0051 //////////////////////////////////////////////////////////////////////////
0052 //                                                                      //
0053 // TQpDataSparse                                                        //
0054 //                                                                      //
0055 // Data for the dense QP formulation                                    //
0056 //                                                                      //
0057 //////////////////////////////////////////////////////////////////////////
0058 
0059 class TQpDataSparse : public TQpDataBase
0060 {
0061 
0062 protected:
0063 
0064    // these variables will be "Used" not copied
0065    TMatrixDSparse fQ;                          // quadratic part of Objective function
0066    TMatrixDSparse fA;                          // Equality constraints
0067    TMatrixDSparse fC;                          // Inequality constraints
0068 
0069 public:
0070 
0071    TQpDataSparse() {}
0072    // data objects of the specified dimensions
0073    TQpDataSparse(Int_t nx,Int_t my,Int_t mz);
0074 
0075    // sets up pointers to the data objects that are passed as arguments
0076    TQpDataSparse(TVectorD &c,TMatrixDSparse &Q,TVectorD &xlow,TVectorD &ixlow,TVectorD &xupp,
0077                  TVectorD &ixupp,TMatrixDSparse &A,TVectorD &bA,TMatrixDSparse &C,TVectorD &clow,
0078                  TVectorD &iclow,TVectorD &cupp,TVectorD &icupp);
0079    TQpDataSparse(const TQpDataSparse &another);
0080 
0081    ~TQpDataSparse() override {}
0082 
0083    void SetNonZeros(Int_t nnzQ,Int_t nnzA,Int_t nnzC);
0084 
0085    void PutQIntoAt(TMatrixDBase &M,Int_t row,Int_t col) override;
0086                                                // insert the Hessian Q into the matrix M for the fundamental
0087                                                // linear system, where M is stored as a TMatrixDSparse
0088    void PutAIntoAt(TMatrixDBase &M,Int_t row,Int_t col) override;
0089                                                // insert the constraint matrix A into the matrix M for the
0090                                                // fundamental linear system, where M is stored as a TMatrixDSparse
0091    void PutCIntoAt(TMatrixDBase &M,Int_t row,Int_t col) override;
0092                                                // insert the constraint matrix C into the matrix M for the
0093                                                // fundamental linear system, where M is stored as a
0094                                                // TMatrixDSparse
0095 
0096    void Qmult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) override;
0097                                                // y = beta * y + alpha * Q * x
0098    void Amult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) override;
0099                                                // y = beta * y + alpha * A * x
0100    void Cmult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) override;
0101                                                // y = beta * y + alpha * C * x
0102    void ATransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) override;
0103                                                // y = beta * y + alpha * A^T * x
0104    void CTransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) override;
0105                                                // y = beta * y + alpha * C^T * x
0106 
0107    void GetDiagonalOfQ(TVectorD &dQ) override;  // extract the diagonal of Q and put it in the vector dQ
0108 
0109    Double_t DataNorm() override;
0110    void DataRandom(TVectorD &x,TVectorD &y,TVectorD &z,TVectorD &s) override;
0111                                                // Create a random problem (x,y,z,s)
0112                                                // the solution to the random problem
0113    void Print(Option_t *opt="") const override;
0114 
0115    Double_t ObjectiveValue(TQpVar *vars) override;
0116 
0117    TQpDataSparse &operator= (const TQpDataSparse &source);
0118 
0119    ClassDefOverride(TQpDataSparse,1)                   // Qp Data class for Sparse formulation
0120 };
0121 #endif