Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpLowRankUpdateSymMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpLowRankUpdateSymMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Andreas Waechter IBM 2005-12-25
8
9 #ifndef __IPLOWRANKUPDATESYMMATRIX_HPP__
10 #define __IPLOWRANKUPDATESYMMATRIX_HPP__
11
12 #include "IpUtils.hpp"
13 #include "IpSymMatrix.hpp"
14 #include "IpMultiVectorMatrix.hpp"
15
16 namespace Ipopt
17 {
18
19 /* forward declarations */
20 class LowRankUpdateSymMatrixSpace;
21
31 class LowRankUpdateSymMatrix : public SymMatrix
32 {
33 public:
34
37
39 LowRankUpdateSymMatrix(const LowRankUpdateSymMatrixSpace* owner_space);
40
42 ~LowRankUpdateSymMatrix();
44
46 void SetDiag(const Vector& D)
47 {
48 D_ = &D;
49 ObjectChanged();
50 }
51
53 SmartPtr<const Vector> GetDiag() const
54 {
55 return D_;
56 }
57
59 void SetV(const MultiVectorMatrix& V)
60 {
61 V_ = &V;
62 ObjectChanged();
63 }
64
66 SmartPtr<const MultiVectorMatrix> GetV() const
67 {
68 return V_;
69 }
70
72 void SetU(const MultiVectorMatrix& U)
73 {
74 U_ = &U;
75 ObjectChanged();
76 }
77
79 SmartPtr<const MultiVectorMatrix> GetU() const
80 {
81 return U_;
82 }
83
86 SmartPtr<const Matrix> P_LowRank() const;
87
90 SmartPtr<const VectorSpace> LowRankVectorSpace() const;
91
94 bool ReducedDiag() const;
95
96 protected:
99 virtual void MultVectorImpl(Number alpha, const Vector& x,
100 Number beta, Vector& y) const;
101
104 virtual bool HasValidNumbersImpl() const;
105
106 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
107
108 virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
109
110 virtual void PrintImpl(const Journalist& jnlst,
111 EJournalLevel level,
112 EJournalCategory category,
113 const std::string& name,
114 Index indent,
115 const std::string& prefix) const;
117
118 private:
128 LowRankUpdateSymMatrix();
129
131 LowRankUpdateSymMatrix(const LowRankUpdateSymMatrix&);
132
134 void operator=(const LowRankUpdateSymMatrix&);
136
138 SmartPtr<const LowRankUpdateSymMatrixSpace> owner_space_;
139
141 SmartPtr<const Vector> D_;
142
144 SmartPtr<const MultiVectorMatrix> V_;
145
147 SmartPtr<const MultiVectorMatrix> U_;
148 };
149
151 class LowRankUpdateSymMatrixSpace : public SymMatrixSpace
152 {
153 public:
157 LowRankUpdateSymMatrixSpace(Index dim,
158 SmartPtr<const Matrix> P_LowRank,
159 SmartPtr<const VectorSpace> LowRankVectorSpace,
160 bool reduced_diag)
161 :
162 SymMatrixSpace(dim),
163 P_LowRank_(P_LowRank),
164 lowrank_vector_space_(LowRankVectorSpace),
165 reduced_diag_(reduced_diag)
166 {
167 DBG_ASSERT(IsValid(lowrank_vector_space_));
168 }
169
171 virtual ~LowRankUpdateSymMatrixSpace()
172 {}
174
177 virtual SymMatrix* MakeNewSymMatrix() const
178 {
179 return MakeNewLowRankUpdateSymMatrix();
180 }
181
183 LowRankUpdateSymMatrix* MakeNewLowRankUpdateSymMatrix() const
184 {
185 return new LowRankUpdateSymMatrix(this);
186 }
187
188 SmartPtr<const Matrix> P_LowRank() const
189 {
190 return P_LowRank_;
191 }
192
193 SmartPtr<const VectorSpace> LowRankVectorSpace() const
194 {
195 return lowrank_vector_space_;
196 }
197
198 bool ReducedDiag() const
199 {
200 return reduced_diag_;
201 }
202
203 private:
213 LowRankUpdateSymMatrixSpace();
214
216 LowRankUpdateSymMatrixSpace(const LowRankUpdateSymMatrixSpace&);
217
219 void operator=(const LowRankUpdateSymMatrixSpace&);
221
225 SmartPtr<const Matrix> P_LowRank_;
226
229 SmartPtr<const VectorSpace> lowrank_vector_space_;
230
233 bool reduced_diag_;
234 };
235
236 inline
237 SmartPtr<const Matrix> LowRankUpdateSymMatrix::P_LowRank() const
238 {
239 return owner_space_->P_LowRank();
240 }
241
242 inline
243 SmartPtr<const VectorSpace> LowRankUpdateSymMatrix::LowRankVectorSpace() const
244 {
245 return owner_space_->LowRankVectorSpace();
246 }
247
248 inline
249 bool LowRankUpdateSymMatrix::ReducedDiag() const
250 {
251 return owner_space_->ReducedDiag();
252 }
253
254 } // namespace Ipopt
255 #endif
Ipopt::LowRankUpdateSymMatrix::LowRankUpdateSymMatrix
LowRankUpdateSymMatrix()
Default Constructor.
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::LowRankUpdateSymMatrixSpace::ReducedDiag
bool ReducedDiag() const
Definition: IpLowRankUpdateSymMatrix.hpp:198
Ipopt::LowRankUpdateSymMatrixSpace::MakeNewLowRankUpdateSymMatrix
LowRankUpdateSymMatrix * MakeNewLowRankUpdateSymMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpLowRankUpdateSymMatrix.hpp:183
IpUtils.hpp
Ipopt::LowRankUpdateSymMatrixSpace::LowRankVectorSpace
SmartPtr< const VectorSpace > LowRankVectorSpace() const
Definition: IpLowRankUpdateSymMatrix.hpp:193
Ipopt::LowRankUpdateSymMatrix::SetV
void SetV(const MultiVectorMatrix &V)
Method for setting the positive low-rank update part.
Definition: IpLowRankUpdateSymMatrix.hpp:59
Ipopt::LowRankUpdateSymMatrixSpace::lowrank_vector_space_
SmartPtr< const VectorSpace > lowrank_vector_space_
Vector space for the space in which the low-rank approximation lives.
Definition: IpLowRankUpdateSymMatrix.hpp:229
IpSymMatrix.hpp
Ipopt::LowRankUpdateSymMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::LowRankUpdateSymMatrix::U_
SmartPtr< const MultiVectorMatrix > U_
Vector storing the negative low-rank update.
Definition: IpLowRankUpdateSymMatrix.hpp:147
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::TaggedObject::ObjectChanged
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
Definition: IpTaggedObject.hpp:117
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::LowRankUpdateSymMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::LowRankUpdateSymMatrixSpace::LowRankUpdateSymMatrixSpace
LowRankUpdateSymMatrixSpace(Index dim, SmartPtr< const Matrix > P_LowRank, SmartPtr< const VectorSpace > LowRankVectorSpace, bool reduced_diag)
Constructor, given the dimension of the matrix.
Definition: IpLowRankUpdateSymMatrix.hpp:157
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::LowRankUpdateSymMatrix::~LowRankUpdateSymMatrix
~LowRankUpdateSymMatrix()
Destructor.
IpMultiVectorMatrix.hpp
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:23
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::LowRankUpdateSymMatrix::owner_space_
SmartPtr< const LowRankUpdateSymMatrixSpace > owner_space_
corresponding matrix space
Definition: IpLowRankUpdateSymMatrix.hpp:138
Ipopt::LowRankUpdateSymMatrixSpace::~LowRankUpdateSymMatrixSpace
virtual ~LowRankUpdateSymMatrixSpace()
Destructor.
Definition: IpLowRankUpdateSymMatrix.hpp:171
Ipopt::LowRankUpdateSymMatrix::P_LowRank
SmartPtr< const Matrix > P_LowRank() const
Return the expansion matrix to lift the low-rank update to the higher-dimensional space...
Definition: IpLowRankUpdateSymMatrix.hpp:237
Ipopt::LowRankUpdateSymMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Ipopt::LowRankUpdateSymMatrix::LowRankVectorSpace
SmartPtr< const VectorSpace > LowRankVectorSpace() const
Return the vector space in with the low-rank update vectors live.
Definition: IpLowRankUpdateSymMatrix.hpp:243
Ipopt::LowRankUpdateSymMatrix::operator=
void operator=(const LowRankUpdateSymMatrix &)
Overloaded Equals Operator.
Ipopt::LowRankUpdateSymMatrix::GetU
SmartPtr< const MultiVectorMatrix > GetU() const
Method for getting the negative low-rank update part.
Definition: IpLowRankUpdateSymMatrix.hpp:79
Ipopt::LowRankUpdateSymMatrix::PrintImpl
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.
Ipopt::MultiVectorMatrix
Class for Matrices with few columns that consists of Vectors.
Definition: IpMultiVectorMatrix.hpp:25
Ipopt::LowRankUpdateSymMatrixSpace::P_LowRank
SmartPtr< const Matrix > P_LowRank() const
Definition: IpLowRankUpdateSymMatrix.hpp:188
Ipopt::LowRankUpdateSymMatrix::SetDiag
void SetDiag(const Vector &D)
Method for setting the diagonal elements (as a Vector).
Definition: IpLowRankUpdateSymMatrix.hpp:46
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::LowRankUpdateSymMatrixSpace
This is the matrix space for LowRankUpdateSymMatrix.
Definition: IpLowRankUpdateSymMatrix.hpp:151
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::LowRankUpdateSymMatrixSpace::reduced_diag_
bool reduced_diag_
Flag indicating whether the diagonal matrix is nonzero only in the space of V or in the full space...
Definition: IpLowRankUpdateSymMatrix.hpp:233
Ipopt::LowRankUpdateSymMatrixSpace::operator=
void operator=(const LowRankUpdateSymMatrixSpace &)
Overloaded Equals Operator.
Ipopt::LowRankUpdateSymMatrix::ReducedDiag
bool ReducedDiag() const
Flag indicating whether the diagonal term lives in the smaller space (from P_LowRank) or in the full ...
Definition: IpLowRankUpdateSymMatrix.hpp:249
Ipopt::SymMatrixSpace
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:81
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::LowRankUpdateSymMatrix::SetU
void SetU(const MultiVectorMatrix &U)
Method for setting the negative low-rank update part.
Definition: IpLowRankUpdateSymMatrix.hpp:72
Ipopt::LowRankUpdateSymMatrixSpace::MakeNewSymMatrix
virtual SymMatrix * MakeNewSymMatrix() const
Overloaded MakeNew method for the SymMatrixSpace base class.
Definition: IpLowRankUpdateSymMatrix.hpp:177
Ipopt::LowRankUpdateSymMatrix::GetDiag
SmartPtr< const Vector > GetDiag() const
Method for getting the diagonal elements.
Definition: IpLowRankUpdateSymMatrix.hpp:53
Ipopt::LowRankUpdateSymMatrix::D_
SmartPtr< const Vector > D_
Vector storing the diagonal matrix D.
Definition: IpLowRankUpdateSymMatrix.hpp:141
Ipopt::LowRankUpdateSymMatrixSpace::LowRankUpdateSymMatrixSpace
LowRankUpdateSymMatrixSpace()
Default Constructor.
Ipopt::LowRankUpdateSymMatrix::V_
SmartPtr< const MultiVectorMatrix > V_
Vector storing the positive low-rank update.
Definition: IpLowRankUpdateSymMatrix.hpp:144
Ipopt::LowRankUpdateSymMatrix
Class for symmetric matrices, represented as low-rank updates.
Definition: IpLowRankUpdateSymMatrix.hpp:31
Ipopt::LowRankUpdateSymMatrix::GetV
SmartPtr< const MultiVectorMatrix > GetV() const
Method for getting the positive low-rank update part.
Definition: IpLowRankUpdateSymMatrix.hpp:66
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::LowRankUpdateSymMatrixSpace::P_LowRank_
SmartPtr< const Matrix > P_LowRank_
Expansion matrix to lift the low-rank approximation into a possibly higher-dimensional space...
Definition: IpLowRankUpdateSymMatrix.hpp:225
Ipopt::LowRankUpdateSymMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Since the matrix is symmetric, the row and column max norms are identical.