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

Last change on this file since 2385 was 2385, checked in by unxusr, 4 months ago

formatting

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