Ipopt Documentation  
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 // Authors: Andreas Waechter IBM 2005-12-24
6 
7 #ifndef __IPDENSEGENMATRIX_HPP__
8 #define __IPDENSEGENMATRIX_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpMatrix.hpp"
12 #include "IpDenseVector.hpp"
13 #include "IpDenseSymMatrix.hpp"
14 
15 namespace Ipopt
16 {
17 
19 class DenseGenMatrixSpace;
20 
26 {
27 public:
28 
33  const DenseGenMatrixSpace* owner_space
34  );
35 
39 
41  SmartPtr<DenseGenMatrix> MakeNewDenseGenMatrix() const;
42 
50  {
51  initialized_ = true;
52  ObjectChanged();
53  return values_;
54  }
55 
61  const Number* Values() const
62  {
63  DBG_ASSERT(initialized_);
64  return values_;
65  }
66 
68  void Copy(
69  const DenseGenMatrix& M
70  );
71 
77  Number factor = 1.
78  );
79 
85  const DenseVector& scal_vec
86  );
87 
90  Number alpha,
91  const DenseGenMatrix& A,
92  bool transA,
93  const DenseGenMatrix& B,
94  bool transB,
95  Number beta
96  );
97 
104  Number alpha,
105  const MultiVectorMatrix& V1,
106  const MultiVectorMatrix& V2,
107  Number beta
108  );
109 
120  const DenseSymMatrix& M
121  );
122 
133  const DenseSymMatrix& M,
134  DenseVector& Evalues
135  );
136 
145  bool trans,
146  Number alpha,
147  DenseGenMatrix& B
148  ) const;
149 
158  DenseVector& b
159  ) const;
160 
169  DenseGenMatrix& B
170  ) const;
171 
176 
181  DenseGenMatrix& B
182  ) const;
183 
188  DenseVector& b
189  ) const;
190 
191 protected:
194  virtual void MultVectorImpl(
195  Number alpha,
196  const Vector& x,
197  Number beta,
198  Vector& y
199  ) const;
200 
201  virtual void TransMultVectorImpl(
202  Number alpha,
203  const Vector& x,
204  Number beta,
205  Vector& y
206  ) const;
207 
208  virtual bool HasValidNumbersImpl() const;
209 
210  virtual void ComputeRowAMaxImpl(
211  Vector& rows_norms,
212  bool init
213  ) const;
214 
215  virtual void ComputeColAMaxImpl(
216  Vector& cols_norms,
217  bool init
218  ) const;
219 
220  virtual void PrintImpl(
221  const Journalist& jnlst,
222  EJournalLevel level,
223  EJournalCategory category,
224  const std::string& name,
225  Index indent,
226  const std::string& prefix
227  ) const;
229 
230 private:
241 
244  const DenseGenMatrix&
245  );
246 
248  void operator=(
249  const DenseGenMatrix&
250  );
252 
254 
257 
260 
263  {
265  LU,
266  CHOL
267  };
268 
271 
274 };
275 
279 {
280 public:
288  Index nRows,
289  Index nCols
290  );
291 
294  { }
296 
299  {
300  return new DenseGenMatrix(this);
301  }
302 
303  virtual Matrix* MakeNew() const
304  {
305  return MakeNewDenseGenMatrix();
306  }
307 
308 };
309 
311 {
313 }
314 
315 } // namespace Ipopt
316 #endif
Ipopt::DenseGenMatrix::~DenseGenMatrix
~DenseGenMatrix()
Destructor.
IpUtils.hpp
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:327
Ipopt::DenseGenMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::DenseGenMatrix::owner_space_
const DenseGenMatrixSpace * owner_space_
Definition: IpDenseGenMatrix.hpp:253
Ipopt::MultiVectorMatrix
Class for Matrices with few columns that consists of Vectors.
Definition: IpMultiVectorMatrix.hpp:25
Ipopt::DenseGenMatrix::pivot_
Index * pivot_
Array for storing the pivot sequences if the matrix has been LU-factorized.
Definition: IpDenseGenMatrix.hpp:273
IpDenseSymMatrix.hpp
Ipopt::DenseGenMatrixSpace
This is the matrix space for DenseGenMatrix.
Definition: IpDenseGenMatrix.hpp:279
Ipopt::DenseGenMatrix::ComputeLUFactorInPlace
bool ComputeLUFactorInPlace()
Method for computing the LU factorization of an unsymmetric matrix.
Ipopt::DenseGenMatrix::Copy
void Copy(const DenseGenMatrix &M)
Method for copying the content of another matrix into this matrix.
Ipopt::DenseGenMatrix
Class for dense general matrices.
Definition: IpDenseGenMatrix.hpp:26
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:14
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Ipopt::DenseGenMatrix::LU
@ LU
Definition: IpDenseGenMatrix.hpp:265
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:28
Ipopt::DenseGenMatrix::operator=
void operator=(const DenseGenMatrix &)
Default Assignment Operator.
Ipopt::DenseGenMatrixSpace::MakeNewDenseGenMatrix
DenseGenMatrix * MakeNewDenseGenMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpDenseGenMatrix.hpp:298
Ipopt::DenseGenMatrix::initialized_
bool initialized_
Flag indicating whether the values_ array has been initialized.
Definition: IpDenseGenMatrix.hpp:259
Ipopt::DenseGenMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:32
Ipopt::DenseGenMatrixSpace::DenseGenMatrixSpace
DenseGenMatrixSpace(Index nRows, Index nCols)
Constructor for matrix space for DenseGenMatrices.
Ipopt::DenseGenMatrix::FillIdentity
void FillIdentity(Number factor=1.)
Set this matrix to be a multiple of the identity matrix.
Ipopt::DenseGenMatrix::Factorization
Factorization
Enum for factorization type.
Definition: IpDenseGenMatrix.hpp:263
IPOPTLIB_EXPORT
#define IPOPTLIB_EXPORT
Definition: config_default.h:16
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::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Ipopt::DenseGenMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
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::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::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::DenseGenMatrix::DenseGenMatrix
DenseGenMatrix(const DenseGenMatrix &)
Copy Constructor.
Ipopt::DenseGenMatrix::DenseGenMatrix
DenseGenMatrix()
Default Constructor.
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:52
Ipopt::DenseGenMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
IpDenseVector.hpp
Ipopt::DenseGenMatrix::factorization_
Factorization factorization_
Flag indicating if and which factorization has been applied.
Definition: IpDenseGenMatrix.hpp:270
Ipopt::DenseGenMatrix::ComputeEigenVectors
bool ComputeEigenVectors(const DenseSymMatrix &M, DenseVector &Evalues)
Method for computing an eigenvalue decomposition of the given symmetrix matrix M.
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:117
Ipopt::DenseGenMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
Definition: IpDenseGenMatrix.hpp:303
Ipopt::DenseGenMatrix::Values
Number * Values()
Retrieve the array for storing the matrix elements.
Definition: IpDenseGenMatrix.hpp:49
Ipopt::DenseGenMatrix::values_
Number * values_
Array for storing the matrix elements (one columns after each other)
Definition: IpDenseGenMatrix.hpp:256
Ipopt::DenseSymMatrix
Class for dense symmetric matrices.
Definition: IpDenseSymMatrix.hpp:28
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.
IpMatrix.hpp
Ipopt::DenseVector
Dense Vector Implementation.
Definition: IpDenseVector.hpp:41
Ipopt::DenseGenMatrix::NONE
@ NONE
Definition: IpDenseGenMatrix.hpp:264
Ipopt::DenseGenMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
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::LUSolveVector
void LUSolveVector(DenseVector &b) const
Method for using a previously computed LU fatorization for a backsolve with a single vector.
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
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::DenseGenMatrix::Values
const Number * Values() const
Retrieve the array that stores the matrix elements.
Definition: IpDenseGenMatrix.hpp:61
Ipopt::DenseGenMatrixSpace::~DenseGenMatrixSpace
~DenseGenMatrixSpace()
Destructor.
Definition: IpDenseGenMatrix.hpp:293
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...
Ipopt::DenseGenMatrix::MakeNewDenseGenMatrix
SmartPtr< DenseGenMatrix > MakeNewDenseGenMatrix() const
Create a new DenseGenMatrix from same MatrixSpace.
Definition: IpDenseGenMatrix.hpp:310
Ipopt::DenseGenMatrix::ComputeCholeskyFactor
bool ComputeCholeskyFactor(const DenseSymMatrix &M)
Method for computing the Cholesky factorization of a positive definite matrix.
Ipopt::DenseGenMatrix::ScaleColumns
void ScaleColumns(const DenseVector &scal_vec)
Method for scaling the columns of the matrix.
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:48
Ipopt::DenseGenMatrix::DenseGenMatrix
DenseGenMatrix(const DenseGenMatrixSpace *owner_space)
Constructor, taking the owner_space.