source: trunk/Clp/src/ClpDummyMatrix.hpp @ 2271

Last change on this file since 2271 was 2271, checked in by forrest, 22 months ago

change some ints to CoinBigIndex?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1/* $Id: ClpDummyMatrix.hpp 2271 2017-08-14 08:50:39Z forrest $ */
2// Copyright (C) 2003, International Business Machines
3// Corporation and others.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef ClpDummyMatrix_H
7#define ClpDummyMatrix_H
8
9
10#include "CoinPragma.hpp"
11
12#include "ClpMatrixBase.hpp"
13
14/** This implements a dummy matrix as derived from ClpMatrixBase.
15    This is so you can do ClpPdco but may come in useful elsewhere.
16    It just has dimensions but no data
17*/
18
19
20class ClpDummyMatrix : public ClpMatrixBase {
21
22public:
23     /**@name Useful methods */
24     //@{
25     /// Return a complete CoinPackedMatrix
26     virtual CoinPackedMatrix * getPackedMatrix() const;
27     /** Whether the packed matrix is column major ordered or not. */
28     virtual bool isColOrdered() const {
29          return true;
30     }
31     /** Number of entries in the packed matrix. */
32     virtual  CoinBigIndex getNumElements() const {
33          return numberElements_;
34     }
35     /** Number of columns. */
36     virtual int getNumCols() const {
37          return numberColumns_;
38     }
39     /** Number of rows. */
40     virtual int getNumRows() const {
41          return numberRows_;
42     }
43
44     /** A vector containing the elements in the packed matrix. Note that there
45      might be gaps in this list, entries that do not belong to any
46      major-dimension vector. To get the actual elements one should look at
47      this vector together with vectorStarts and vectorLengths. */
48     virtual const double * getElements() const;
49     /** A vector containing the minor indices of the elements in the packed
50          matrix. Note that there might be gaps in this list, entries that do not
51          belong to any major-dimension vector. To get the actual elements one
52          should look at this vector together with vectorStarts and
53          vectorLengths. */
54     virtual const int * getIndices() const;
55
56     virtual const CoinBigIndex * getVectorStarts() const;
57     /** The lengths of the major-dimension vectors. */
58     virtual const int * getVectorLengths() const;
59
60     /** Delete the columns whose indices are listed in <code>indDel</code>. */
61     virtual void deleteCols(const int numDel, const int * indDel);
62     /** Delete the rows whose indices are listed in <code>indDel</code>. */
63     virtual void deleteRows(const int numDel, const int * indDel);
64     /** Returns a new matrix in reverse order without gaps */
65     virtual ClpMatrixBase * reverseOrderedCopy() const;
66     /// Returns number of elements in column part of basis
67     virtual int countBasis(const int * whichColumn,
68                                     int & numberColumnBasic);
69     /// Fills in column part of basis
70     virtual void fillBasis(ClpSimplex * model,
71                            const int * whichColumn,
72                            int & numberColumnBasic,
73                            int * row, int * start,
74                            int * rowCount, int * columnCount,
75                            CoinFactorizationDouble * element);
76     /** Unpacks a column into an CoinIndexedvector
77      */
78     virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
79                         int column) const ;
80     /** Unpacks a column into an CoinIndexedvector
81      ** in packed foramt
82         Note that model is NOT const.  Bounds and objective could
83         be modified if doing column generation (just for this variable) */
84     virtual void unpackPacked(ClpSimplex * model,
85                               CoinIndexedVector * rowArray,
86                               int column) const;
87     /** Adds multiple of a column into an CoinIndexedvector
88         You can use quickAdd to add to vector */
89     virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
90                      int column, double multiplier) const ;
91     /** Adds multiple of a column into an array */
92     virtual void add(const ClpSimplex * model, double * array,
93                      int column, double multiplier) const;
94     /// Allow any parts of a created CoinMatrix to be deleted
95     /// Allow any parts of a created CoinPackedMatrix to be deleted
96     virtual void releasePackedMatrix() const {}
97     //@}
98
99     /**@name Matrix times vector methods */
100     //@{
101     /** Return <code>y + A * scalar *x</code> in <code>y</code>.
102         @pre <code>x</code> must be of size <code>numColumns()</code>
103         @pre <code>y</code> must be of size <code>numRows()</code> */
104     virtual void times(double scalar,
105                        const double * x, double * y) const;
106     /// And for scaling
107     virtual void times(double scalar,
108                        const double * x, double * y,
109                        const double * rowScale,
110                        const double * columnScale) const;
111     /** Return <code>y + x * scalar * A</code> in <code>y</code>.
112         @pre <code>x</code> must be of size <code>numRows()</code>
113         @pre <code>y</code> must be of size <code>numColumns()</code> */
114     virtual void transposeTimes(double scalar,
115                                 const double * x, double * y) const;
116     /// And for scaling
117     virtual void transposeTimes(double scalar,
118                                 const double * x, double * y,
119                                 const double * rowScale,
120                                 const double * columnScale) const;
121
122     using ClpMatrixBase::transposeTimes ;
123     /** Return <code>x * scalar * A + y</code> in <code>z</code>.
124     Can use y as temporary array (will be empty at end)
125     Note - If x packed mode - then z packed mode */
126     virtual void transposeTimes(const ClpSimplex * model, double scalar,
127                                 const CoinIndexedVector * x,
128                                 CoinIndexedVector * y,
129                                 CoinIndexedVector * z) const;
130     /** Return <code>x *A</code> in <code>z</code> but
131     just for indices in y.
132     Note - If x packed mode - then z packed mode
133     Squashes small elements and knows about ClpSimplex */
134     virtual void subsetTransposeTimes(const ClpSimplex * model,
135                                       const CoinIndexedVector * x,
136                                       const CoinIndexedVector * y,
137                                       CoinIndexedVector * z) const;
138     //@}
139
140     /**@name Other */
141     //@{
142     //@}
143
144
145     /**@name Constructors, destructor */
146     //@{
147     /** Default constructor. */
148     ClpDummyMatrix();
149     /// Constructor with data
150     ClpDummyMatrix(int numberColumns, int numberRows,
151                    int numberElements);
152     /** Destructor */
153     virtual ~ClpDummyMatrix();
154     //@}
155
156     /**@name Copy method */
157     //@{
158     /** The copy constructor. */
159     ClpDummyMatrix(const ClpDummyMatrix&);
160     /** The copy constructor from an CoinDummyMatrix. */
161     ClpDummyMatrix(const CoinPackedMatrix&);
162
163     ClpDummyMatrix& operator=(const ClpDummyMatrix&);
164     /// Clone
165     virtual ClpMatrixBase * clone() const ;
166     //@}
167
168
169protected:
170     /**@name Data members
171        The data members are protected to allow access for derived classes. */
172     //@{
173     /// Number of rows
174     int numberRows_;
175     /// Number of columns
176     int numberColumns_;
177     /// Number of elements
178     int numberElements_;
179
180     //@}
181};
182
183#endif
Note: See TracBrowser for help on using the repository browser.