Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpExpansionMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpExpansionMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPEXPANSIONMATRIX_HPP__
10 #define __IPEXPANSIONMATRIX_HPP__
11 
12 #include "IpUtils.hpp"
13 #include "IpMatrix.hpp"
14 
15 namespace Ipopt
16 {
17 
19  class ExpansionMatrixSpace;
20 
27  class ExpansionMatrix : public Matrix
28  {
29  public:
30 
33 
36  ExpansionMatrix(const ExpansionMatrixSpace* owner_space);
37 
41 
49  const Index* ExpandedPosIndices() const;
50 
59  const Index* CompressedPosIndices() const;
60 
61  protected:
64  virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
65  Vector &y) const;
66 
67  virtual void TransMultVectorImpl(Number alpha, const Vector& x,
68  Number beta, Vector& y) const;
69 
72  virtual void AddMSinvZImpl(Number alpha, const Vector& S, const Vector& Z,
73  Vector& X) const;
74 
77  virtual void SinvBlrmZMTdBrImpl(Number alpha, const Vector& S,
78  const Vector& R, const Vector& Z,
79  const Vector& D, Vector& X) const;
80 
81  virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
82 
83  virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
84 
85  virtual void PrintImpl(const Journalist& jnlst,
86  EJournalLevel level,
87  EJournalCategory category,
88  const std::string& name,
89  Index indent,
90  const std::string& prefix) const
91  {
92  PrintImplOffset(jnlst, level, category, name, indent, prefix, 1, 1);
93  }
95 
96  void PrintImplOffset(const Journalist& jnlst,
97  EJournalLevel level,
98  EJournalCategory category,
99  const std::string& name,
100  Index indent,
101  const std::string& prefix,
102  Index row_offset,
103  Index col_offset) const;
104 
105  friend class ParExpansionMatrix;
106 
107  private:
117  ExpansionMatrix();
118 
121 
123  void operator=(const ExpansionMatrix&);
125 
127 
128  };
129 
133  {
134  public:
144  ExpansionMatrixSpace(Index NLargeVec,
145  Index NSmallVec,
146  const Index *ExpPos,
147  const int offset = 0);
148 
151  {
152  delete [] compressed_pos_;
153  delete [] expanded_pos_;
154  }
156 
159  {
160  return new ExpansionMatrix(this);
161  }
162 
165  virtual Matrix* MakeNew() const
166  {
167  return MakeNewExpansionMatrix();
168  }
169 
176  const Index* ExpandedPosIndices() const
177  {
178  return expanded_pos_;
179  }
180 
189  {
190  return compressed_pos_;
191  }
192 
193  private:
196  };
197 
198  /* inline methods */
199  inline
201  {
203  }
204 
205  inline
207  {
209  }
210 
211 } // namespace Ipopt
212 #endif
Number * x
Input: Starting point Output: Optimal solution.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
virtual void SinvBlrmZMTdBrImpl(Number alpha, const Vector &S, const Vector &R, const Vector &Z, const Vector &D, Vector &X) const
X = S^{-1} (r + alpha*Z*M^Td).
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Vector Base Class.
Definition: IpVector.hpp:47
const Index * CompressedPosIndices() const
Accessor Method to obtain the Index array (of length NLargeVec=NRows()) that stores the mapping from ...
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Print detailed information about the matrix.
EJournalLevel
Print Level Enum.
void PrintImplOffset(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix, Index row_offset, Index col_offset) const
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Matrix Base Class.
Definition: IpMatrix.hpp:27
virtual void AddMSinvZImpl(Number alpha, const Vector &S, const Vector &Z, Vector &X) const
X = beta*X + alpha*(Matrix S^{-1} Z).
const Index * CompressedPosIndices() const
Return the vector of indices marking the compressed position.
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
This is the matrix space for ExpansionMatrix.
ExpansionMatrixSpace(Index NLargeVec, Index NSmallVec, const Index *ExpPos, const int offset=0)
Constructor, given the list of elements of the large vector (of size NLargeVec) to be filtered into t...
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Class for expansion/projection matrices.
Class responsible for all message output.
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
ExpansionMatrix()
Default Constructor.
const Index * ExpandedPosIndices() const
Accessor Method to obtain the Index array (of length NSmallVec=NCols()) that stores the mapping from ...
const Index * ExpandedPosIndices() const
Return the vector of indices marking the expanded position.
const ExpansionMatrixSpace * owner_space_
ExpansionMatrix * MakeNewExpansionMatrix() const
Method for creating a new matrix of this specific type.
~ExpansionMatrix()
Destructor.
EJournalCategory
Category Selection Enum.
void operator=(const ExpansionMatrix &)
Overloaded Equals Operator.