Ipopt 3.11.9
Loading...
Searching...
No Matches
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 1861 2010-12-21 21:34:47Z andreasw $
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
17namespace Ipopt
18{
19
21 class DenseGenMatrixSpace;
22
26 class DenseGenMatrix : public Matrix
27 {
28 public:
29
32
36
40
43
49 {
50 initialized_ = true;
52 return values_;
53 }
54
58 const Number* Values() const
59 {
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
78 bool transA, const DenseGenMatrix& B,
79 bool transB, Number beta);
80
85 const MultiVectorMatrix& V1,
86 const MultiVectorMatrix& V2,
87 Number beta);
88
95
102 DenseVector& Evalues);
103
109 void CholeskyBackSolveMatrix(bool trans, Number alpha,
110 DenseGenMatrix& B) const;
111
117
124
128
132
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:
174
177
181
183
187
190
198
201
203 int* pivot_;
204 };
205
209 {
210 public:
217
222
225 {
226 return new DenseGenMatrix(this);
227 }
228
231 virtual Matrix* MakeNew() const
232 {
233 return MakeNewDenseGenMatrix();
234 }
235
236 };
237
238 inline
243
244} // namespace Ipopt
245#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:38
Number * x
Input: Starting point Output: Optimal solution.
This is the matrix space for DenseGenMatrix.
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
DenseGenMatrixSpace(Index nRows, Index nCols)
Constructor for matrix space for DenseGenMatrices.
DenseGenMatrix * MakeNewDenseGenMatrix() const
Method for creating a new matrix of this specific type.
Class for dense general matrices.
DenseGenMatrix()
Default Constructor.
const Number * Values() const
Retrieve the array that stores the matrix elements.
DenseGenMatrix(const DenseGenMatrixSpace *owner_space)
Constructor, taking the owner_space.
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.
void FillIdentity(Number factor=1.)
Set this matrix to be a multiple of the identity matrix .
DenseGenMatrix(const DenseGenMatrix &)
Copy Constructor.
void CholeskySolveMatrix(DenseGenMatrix &B) const
Method for performing a solve of a linear system for one right-hand-side matrix, assuming that this m...
bool ComputeCholeskyFactor(const DenseSymMatrix &M)
Method for computing the Cholesky factorization of a positive definite matrix.
int * pivot_
Array for storing the pivot sequences if the matrix has been LU-factorized.
bool ComputeEigenVectors(const DenseSymMatrix &M, DenseVector &Evalues)
Method for computing an eigenvalue decomposition of the given symmetrix matrix M.
void CholeskySolveVector(DenseVector &b) const
Method for performing a solve of a linear system for one vector, assuming that this matrix contains t...
SmartPtr< DenseGenMatrix > MakeNewDenseGenMatrix() const
Create a new DenseGenMatrix from same MatrixSpace.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
Factorization factorization_
Flag indicating if and which factorization has been applied.
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.
Factorization
Enum for factorization type.
void LUSolveVector(DenseVector &b) const
Method for using a previously computed LU fatorization for a backsolve with a single vector.
const DenseGenMatrixSpace * owner_space_
Number * values_
Array for storing the matrix elements (one columns after each other)
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
void operator=(const DenseGenMatrix &)
Overloaded Equals Operator.
void Copy(const DenseGenMatrix &M)
Method for copying the content of another matrix into this matrix.
~DenseGenMatrix()
Destructor.
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
void HighRankUpdateTranspose(Number alpha, const MultiVectorMatrix &V1, const MultiVectorMatrix &V2, Number beta)
Method for adding a high-rank update to this matrix.
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...
bool ComputeLUFactorInPlace()
Method for computing the LU factorization of an unsymmetric matrix.
void LUSolveMatrix(DenseGenMatrix &B) const
Method for using a previously computed LU factorization for a backsolve with a matrix on the rhs.
Number * Values()
Retrieve the array for storing the matrix elements.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
bool initialized_
Flag indicating whether the values_ array has been initialized.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
void ScaleColumns(const DenseVector &scal_vec)
Method for scaling the columns of the matrix.
Class for dense symetrix matrices.
Dense Vector Implementation.
Class responsible for all message output.
MatrixSpace base class, corresponding to the Matrix base class.
Definition IpMatrix.hpp:240
Matrix Base Class.
Definition IpMatrix.hpp:28
Class for Matrices with few columns that consists of Vectors.
Template class for Smart Pointers.
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
Vector Base Class.
Definition IpVector.hpp:48
EJournalCategory
Category Selection Enum.
int Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:19
EJournalLevel
Print Level Enum.
double Number
Type of all numbers.
Definition IpTypes.hpp:17