Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpDenseGenMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpDenseGenMatrix.hpp 2509 2014-11-21 10:07:35Z stefan $
6 //
7 // Authors: Andreas Waechter IBM 2005-12-24
8
9 #ifndef __IPDENSEGENMATRIX_HPP__
10 #define __IPDENSEGENMATRIX_HPP__
11
12 #include "IpUtils.hpp"
13 #include "IpMatrix.hpp"
14 #include "IpDenseVector.hpp"
15 #include "IpDenseSymMatrix.hpp"
16
17 namespace Ipopt
18 {
19
21 class DenseGenMatrixSpace;
22
26 class DenseGenMatrix : public Matrix
27 {
28 public:
29
32
35 DenseGenMatrix(const DenseGenMatrixSpace* owner_space);
36
38 ~DenseGenMatrix();
40
42 SmartPtr<DenseGenMatrix> MakeNewDenseGenMatrix() const;
43
48 Number* Values()
49 {
50 initialized_ = true;
51 ObjectChanged();
52 return values_;
53 }
54
58 const Number* Values() const
59 {
60 DBG_ASSERT(initialized_);
61 return values_;
62 }
63
66 void Copy(const DenseGenMatrix& M);
67
70 void FillIdentity(Number factor=1.);
71
74 void ScaleColumns(const DenseVector& scal_vec);
75
77 void AddMatrixProduct(Number alpha, const DenseGenMatrix& A,
78 bool transA, const DenseGenMatrix& B,
79 bool transB, Number beta);
80
84 void HighRankUpdateTranspose(Number alpha,
85 const MultiVectorMatrix& V1,
86 const MultiVectorMatrix& V2,
87 Number beta);
88
94 bool ComputeCholeskyFactor(const DenseSymMatrix& M);
95
101 bool ComputeEigenVectors(const DenseSymMatrix& M,
102 DenseVector& Evalues);
103
109 void CholeskyBackSolveMatrix(bool trans, Number alpha,
110 DenseGenMatrix& B) const;
111
116 void CholeskySolveVector(DenseVector& b) const;
117
123 void CholeskySolveMatrix(DenseGenMatrix& B) const;
124
127 bool ComputeLUFactorInPlace();
128
131 void LUSolveMatrix(DenseGenMatrix& B) const;
132
135 void LUSolveVector(DenseVector& b) const;
136
137 protected:
140 virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
141 Vector &y) const;
142
143 virtual void TransMultVectorImpl(Number alpha, const Vector& x,
144 Number beta, Vector& y) const;
145
148 virtual bool HasValidNumbersImpl() const;
149
150 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
151
152 virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
153
154 virtual void PrintImpl(const Journalist& jnlst,
155 EJournalLevel level,
156 EJournalCategory category,
157 const std::string& name,
158 Index indent,
159 const std::string& prefix) const;
161
162
163 private:
173 DenseGenMatrix();
174
176 DenseGenMatrix(const DenseGenMatrix&);
177
179 void operator=(const DenseGenMatrix&);
181
182 const DenseGenMatrixSpace* owner_space_;
183
186 Number* values_;
187
189 bool initialized_;
190
192 enum Factorization
193 {
194 NONE,
195 LU,
196 CHOL
197 };
198
200 Factorization factorization_;
201
203 Index* pivot_;
204 };
205
208 class DenseGenMatrixSpace : public MatrixSpace
209 {
210 public:
216 DenseGenMatrixSpace(Index nRows, Index nCols);
217
219 ~DenseGenMatrixSpace()
220 {}
222
224 DenseGenMatrix* MakeNewDenseGenMatrix() const
225 {
226 return new DenseGenMatrix(this);
227 }
228
231 virtual Matrix* MakeNew() const
232 {
233 return MakeNewDenseGenMatrix();
234 }
235
236 };
237
238 inline
239 SmartPtr<DenseGenMatrix> DenseGenMatrix::MakeNewDenseGenMatrix() const
240 {
241 return owner_space_->MakeNewDenseGenMatrix();
242 }
243
244 } // namespace Ipopt
245 #endif
Ipopt::DenseGenMatrix::MakeNewDenseGenMatrix
SmartPtr< DenseGenMatrix > MakeNewDenseGenMatrix() const
Create a new DenseGenMatrix from same MatrixSpace.
Definition: IpDenseGenMatrix.hpp:239
Ipopt::DenseGenMatrix::CHOL
Definition: IpDenseGenMatrix.hpp:196
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::DenseGenMatrix::LUSolveMatrix
void LUSolveMatrix(DenseGenMatrix &B) const
Method for using a previously computed LU factorization for a backsolve with a matrix on the rhs...
Ipopt::DenseGenMatrixSpace::~DenseGenMatrixSpace
~DenseGenMatrixSpace()
Destructor.
Definition: IpDenseGenMatrix.hpp:219
IpUtils.hpp
Ipopt::DenseGenMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::DenseGenMatrix::ScaleColumns
void ScaleColumns(const DenseVector &scal_vec)
Method for scaling the columns of the matrix.
Ipopt::DenseGenMatrix::AddMatrixProduct
void AddMatrixProduct(Number alpha, const DenseGenMatrix &A, bool transA, const DenseGenMatrix &B, bool transB, Number beta)
Method for adding the product of two matrices to this matrix.
Ipopt::DenseGenMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Ipopt::DenseGenMatrix::DenseGenMatrix
DenseGenMatrix()
Default Constructor.
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::DenseGenMatrix::owner_space_
const DenseGenMatrixSpace * owner_space_
Definition: IpDenseGenMatrix.hpp:182
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
IpDenseSymMatrix.hpp
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::DenseSymMatrix
Class for dense symetrix matrices.
Definition: IpDenseSymMatrix.hpp:31
Ipopt::DenseGenMatrix::~DenseGenMatrix
~DenseGenMatrix()
Destructor.
Ipopt::DenseGenMatrix::NONE
Definition: IpDenseGenMatrix.hpp:194
Ipopt::DenseVector
Dense Vector Implementation.
Definition: IpDenseVector.hpp:40
Ipopt::DenseGenMatrix::CholeskySolveMatrix
void CholeskySolveMatrix(DenseGenMatrix &B) const
Method for performing a solve of a linear system for one right-hand-side matrix, assuming that this m...
IpMatrix.hpp
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::DenseGenMatrix::Values
const Number * Values() const
Retrieve the array that stores the matrix elements.
Definition: IpDenseGenMatrix.hpp:58
Ipopt::DenseGenMatrixSpace::DenseGenMatrixSpace
DenseGenMatrixSpace(Index nRows, Index nCols)
Constructor for matrix space for DenseGenMatrices.
Ipopt::DenseGenMatrix::ComputeLUFactorInPlace
bool ComputeLUFactorInPlace()
Method for computing the LU factorization of an unsymmetric matrix.
Ipopt::DenseGenMatrix::factorization_
Factorization factorization_
Flag indicating if and which factorization has been applied.
Definition: IpDenseGenMatrix.hpp:200
Ipopt::DenseGenMatrix::Copy
void Copy(const DenseGenMatrix &M)
Method for copying the content of another matrix into this matrix.
Ipopt::DenseGenMatrix::LU
Definition: IpDenseGenMatrix.hpp:195
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::DenseGenMatrix::values_
Number * values_
Array for storing the matrix elements (one columns after each other)
Definition: IpDenseGenMatrix.hpp:186
Ipopt::DenseGenMatrix::initialized_
bool initialized_
Flag indicating whether the values_ array has been initialized.
Definition: IpDenseGenMatrix.hpp:189
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
Ipopt::DenseGenMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Definition: IpDenseGenMatrix.hpp:231
Ipopt::DenseGenMatrix::Factorization
Factorization
Enum for factorization type.
Definition: IpDenseGenMatrix.hpp:192
Ipopt::DenseGenMatrix::operator=
void operator=(const DenseGenMatrix &)
Overloaded Equals Operator.
Ipopt::MultiVectorMatrix
Class for Matrices with few columns that consists of Vectors.
Definition: IpMultiVectorMatrix.hpp:25
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Ipopt::DenseGenMatrixSpace
This is the matrix space for DenseGenMatrix.
Definition: IpDenseGenMatrix.hpp:208
Ipopt::DenseGenMatrix::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::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::DenseGenMatrix::FillIdentity
void FillIdentity(Number factor=1.)
Set this matrix to be a multiple of the identity matrix .
IpDenseVector.hpp
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::DenseGenMatrix::CholeskyBackSolveMatrix
void CholeskyBackSolveMatrix(bool trans, Number alpha, DenseGenMatrix &B) const
Method for performing one backsolve with an entire matrix on the right hand side, assuming that the t...
Ipopt::DenseGenMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
Ipopt::DenseGenMatrix::ComputeCholeskyFactor
bool ComputeCholeskyFactor(const DenseSymMatrix &M)
Method for computing the Cholesky factorization of a positive definite matrix.
Ipopt::DenseGenMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
Ipopt::DenseGenMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::DenseGenMatrix
Class for dense general matrices.
Definition: IpDenseGenMatrix.hpp:26
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::DenseGenMatrixSpace::MakeNewDenseGenMatrix
DenseGenMatrix * MakeNewDenseGenMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpDenseGenMatrix.hpp:224
Ipopt::DenseGenMatrix::LUSolveVector
void LUSolveVector(DenseVector &b) const
Method for using a previously computed LU fatorization for a backsolve with a single vector...
Ipopt::DenseGenMatrix::CholeskySolveVector
void CholeskySolveVector(DenseVector &b) const
Method for performing a solve of a linear system for one vector, assuming that this matrix contains t...
Ipopt::DenseGenMatrix::pivot_
Index * pivot_
Array for storing the pivot sequences if the matrix has been LU-factorized.
Definition: IpDenseGenMatrix.hpp:203
Ipopt::DenseGenMatrix::ComputeEigenVectors
bool ComputeEigenVectors(const DenseSymMatrix &M, DenseVector &Evalues)
Method for computing an eigenvalue decomposition of the given symmetrix matrix M. ...
Ipopt::DenseGenMatrix::HighRankUpdateTranspose
void HighRankUpdateTranspose(Number alpha, const MultiVectorMatrix &V1, const MultiVectorMatrix &V2, Number beta)
Method for adding a high-rank update to this matrix.
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::DenseGenMatrix::Values
Number * Values()
Retrieve the array for storing the matrix elements.
Definition: IpDenseGenMatrix.hpp:48