Ipopt Documentation  
IpExpandedMultiVectorMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Andreas Waechter IBM 2009-11-05
6 
7 #ifndef __IPEXPANDEDMULTIVECTORMATRIX_HPP__
8 #define __IPEXPANDEDMULTIVECTORMATRIX_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpMatrix.hpp"
12 #include "IpExpansionMatrix.hpp"
13 
14 namespace Ipopt
15 {
16 
18 class ExpandedMultiVectorMatrixSpace;
19 
29 {
30 public:
35  const ExpandedMultiVectorMatrixSpace* owner_space
36  );
37 
40  { }
42 
44 
48  void SetVector(
49  Index i,
51  );
52 
55  Index i
56  ) const
57  {
58  DBG_ASSERT(i < NRows());
59  return vecs_[i];
60  }
61 
64 
67 
73 
74 protected:
77  virtual void MultVectorImpl(
78  Number alpha,
79  const Vector& x,
80  Number beta,
81  Vector& y
82  ) const;
83 
84  virtual void TransMultVectorImpl(
85  Number alpha,
86  const Vector& x,
87  Number beta,
88  Vector& y
89  ) const;
90 
92  virtual bool HasValidNumbersImpl() const;
93 
94  virtual void ComputeRowAMaxImpl(
95  Vector& rows_norms,
96  bool init
97  ) const;
98 
99  virtual void ComputeColAMaxImpl(
100  Vector& cols_norms,
101  bool init
102  ) const;
103 
104  virtual void PrintImpl(
105  const Journalist& jnlst,
106  EJournalLevel level,
107  EJournalCategory category,
108  const std::string& name,
109  Index indent,
110  const std::string& prefix
111  ) const;
113 
114 private:
126 
130  );
131 
133  void operator=(
135  );
137 
139 
141  std::vector<SmartPtr<const Vector> > vecs_;
142 
143 };
144 
147 {
148 public:
155  Index nrows,
156  const VectorSpace& vec_space,
158  );
159 
162  { }
164 
167  {
168  return new ExpandedMultiVectorMatrix(this);
169  }
170 
171  virtual Matrix* MakeNew() const
172  {
174  }
175 
178  {
179  return vec_space_;
180  }
181 
183  {
184  return exp_matrix_;
185  }
186 
187 private:
189 
191 };
192 
194 {
196 }
197 
199 {
200  return owner_space_->RowVectorSpace();
201 }
202 
204 {
206 }
207 
209 {
210  return owner_space_;
211 }
212 
213 } // namespace Ipopt
214 #endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
This is the matrix space for ExpandedMultiVectorMatrix.
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
SmartPtr< const VectorSpace > RowVectorSpace() const
Accessor method for the VectorSpace for the rows.
ExpandedMultiVectorMatrixSpace(Index nrows, const VectorSpace &vec_space, SmartPtr< const ExpansionMatrix > exp_matrix)
Constructor, given the number of rows (i.e., Vectors to be stored) and given the VectorSpace for the ...
SmartPtr< const ExpansionMatrix > GetExpansionMatrix() const
ExpandedMultiVectorMatrix * MakeNewExpandedMultiVectorMatrix() const
Method for creating a new matrix of this specific type.
SmartPtr< const ExpansionMatrix > exp_matrix_
Class for Matrices with few rows that consists of Vectors, together with a premultiplied Expansion ma...
std::vector< SmartPtr< const Vector > > vecs_
space for storing the const Vector's
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
SmartPtr< const ExpandedMultiVectorMatrixSpace > ExpandedMultiVectorMatrixOwnerSpace() const
Return the ExpandedMultiVectorMatrixSpace.
SmartPtr< const Vector > GetVector(Index i) const
Get a Vector in a particular row as a const Vector.
SmartPtr< const ExpansionMatrix > GetExpansionMatrix() const
Return the Expansion matrix.
SmartPtr< const VectorSpace > RowVectorSpace() const
Vector space for the rows.
ExpandedMultiVectorMatrix(const ExpandedMultiVectorMatrixSpace *owner_space)
Constructor, taking the owner_space.
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
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.
SmartPtr< ExpandedMultiVectorMatrix > MakeNewExpandedMultiVectorMatrix() const
void operator=(const ExpandedMultiVectorMatrix &)
Default Assignment Operator.
ExpandedMultiVectorMatrix()
Default Constructor.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
void SetVector(Index i, SmartPtr< const Vector > vec)
Set a particular Vector at a given row position, replacing another vector if there has been one.
const ExpandedMultiVectorMatrixSpace * owner_space_
ExpandedMultiVectorMatrix(const ExpandedMultiVectorMatrix &)
Copy Constructor.
Class responsible for all message output.
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:327
Matrix Base Class.
Definition: IpMatrix.hpp:28
Index NRows() const
Number of rows.
Definition: IpMatrix.hpp:401
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
VectorSpace base class, corresponding to the Vector base class.
Definition: IpVector.hpp:459
Vector Base Class.
Definition: IpVector.hpp:48
This file contains a base class for all exceptions and a set of macros to help with exceptions.
EJournalCategory
Category Selection Enum.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
EJournalLevel
Print Level Enum.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15