Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Types | Private Attributes | List of all members
Ipopt::DenseGenMatrix Class Reference

Class for dense general matrices. More...

#include <IpDenseGenMatrix.hpp>

+ Inheritance diagram for Ipopt::DenseGenMatrix:

Public Member Functions

SmartPtr< DenseGenMatrixMakeNewDenseGenMatrix () const
 Create a new DenseGenMatrix from same MatrixSpace. More...
 
NumberValues ()
 Retrieve the array for storing the matrix elements. More...
 
const NumberValues () const
 Retrieve the array that stores the matrix elements. More...
 
void Copy (const DenseGenMatrix &M)
 Method for copying the content of another matrix into this matrix. More...
 
void FillIdentity (Number factor=1.)
 Set this matrix to be a multiple of the identity matrix . More...
 
void ScaleColumns (const DenseVector &scal_vec)
 Method for scaling the columns of the matrix. More...
 
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. More...
 
void HighRankUpdateTranspose (Number alpha, const MultiVectorMatrix &V1, const MultiVectorMatrix &V2, Number beta)
 Method for adding a high-rank update to this matrix. More...
 
bool ComputeCholeskyFactor (const DenseSymMatrix &M)
 Method for computing the Cholesky factorization of a positive definite matrix. More...
 
bool ComputeEigenVectors (const DenseSymMatrix &M, DenseVector &Evalues)
 Method for computing an eigenvalue decomposition of the given symmetrix matrix M. More...
 
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 this matrix is square and contains a lower triangular matrix. More...
 
void CholeskySolveVector (DenseVector &b) const
 Method for performing a solve of a linear system for one vector, assuming that this matrix contains the Cholesky factor for the linear system. More...
 
void CholeskySolveMatrix (DenseGenMatrix &B) const
 Method for performing a solve of a linear system for one right-hand-side matrix, assuming that this matrix contains the Cholesky factor for the linear system. More...
 
bool ComputeLUFactorInPlace ()
 Method for computing the LU factorization of an unsymmetric matrix. More...
 
void LUSolveMatrix (DenseGenMatrix &B) const
 Method for using a previously computed LU factorization for a backsolve with a matrix on the rhs. More...
 
void LUSolveVector (DenseVector &b) const
 Method for using a previously computed LU fatorization for a backsolve with a single vector. More...
 
Constructors / Destructors
 DenseGenMatrix (const DenseGenMatrixSpace *owner_space)
 Constructor, taking the owner_space. More...
 
 ~DenseGenMatrix ()
 Destructor. More...
 
- Public Member Functions inherited from Ipopt::Matrix
bool HasValidNumbers () const
 Method for determining if all stored numbers are valid (i.e., no Inf or Nan). More...
 
SmartPtr< const MatrixSpaceOwnerSpace () const
 Return the owner MatrixSpace. More...
 
 Matrix (const MatrixSpace *owner_space)
 Constructor. More...
 
virtual ~Matrix ()
 Destructor. More...
 
void MultVector (Number alpha, const Vector &x, Number beta, Vector &y) const
 Matrix-vector multiply. More...
 
void TransMultVector (Number alpha, const Vector &x, Number beta, Vector &y) const
 Matrix(transpose) vector multiply. More...
 
void AddMSinvZ (Number alpha, const Vector &S, const Vector &Z, Vector &X) const
 X = X + alpha*(Matrix S^{-1} Z). More...
 
void SinvBlrmZMTdBr (Number alpha, const Vector &S, const Vector &R, const Vector &Z, const Vector &D, Vector &X) const
 X = S^{-1} (r + alpha*Z*M^Td). More...
 
Index NRows () const
 Number of rows. More...
 
Index NCols () const
 Number of columns. More...
 
void ComputeRowAMax (Vector &rows_norms, bool init=true) const
 Compute the max-norm of the rows in the matrix. More...
 
void ComputeColAMax (Vector &cols_norms, bool init=true) const
 Compute the max-norm of the columns in the matrix. More...
 
virtual void Print (SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
 Print detailed information about the matrix. More...
 
virtual void Print (const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
 
- Public Member Functions inherited from Ipopt::TaggedObject
 TaggedObject ()
 Constructor. More...
 
virtual ~TaggedObject ()
 Destructor. More...
 
Tag GetTag () const
 Users of TaggedObjects call this to update their own internal tags every time they perform the expensive operation. More...
 
bool HasChanged (const Tag comparison_tag) const
 Users of TaggedObjects call this to check if the object HasChanged since they last updated their own internal tag. More...
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 
- Public Member Functions inherited from Ipopt::Subject
 Subject ()
 Default Constructor. More...
 
virtual ~Subject ()
 Default destructor. More...
 
void AttachObserver (Observer::NotifyType notify_type, Observer *observer) const
 Attach the specified observer (i.e., begin recieving notifications). More...
 
void DetachObserver (Observer::NotifyType notify_type, Observer *observer) const
 Detach the specified observer (i.e., no longer recieve notifications). More...
 

Protected Member Functions

Overloaded methods from Matrix base class
virtual void MultVectorImpl (Number alpha, const Vector &x, Number beta, Vector &y) const
 Matrix-vector multiply. More...
 
virtual void TransMultVectorImpl (Number alpha, const Vector &x, Number beta, Vector &y) const
 Matrix(transpose) vector multiply. More...
 
virtual bool HasValidNumbersImpl () const
 Method for determining if all stored numbers are valid (i.e., no Inf or Nan). More...
 
virtual void ComputeRowAMaxImpl (Vector &rows_norms, bool init) const
 Compute the max-norm of the rows in the matrix. More...
 
virtual void ComputeColAMaxImpl (Vector &cols_norms, bool init) const
 Compute the max-norm of the columns in the matrix. More...
 
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. More...
 
- Protected Member Functions inherited from Ipopt::Matrix
virtual void AddMSinvZImpl (Number alpha, const Vector &S, const Vector &Z, Vector &X) const
 X = X + alpha*(Matrix S^{-1} Z). More...
 
virtual void SinvBlrmZMTdBrImpl (Number alpha, const Vector &S, const Vector &R, const Vector &Z, const Vector &D, Vector &X) const
 X = S^{-1} (r + alpha*Z*M^Td). More...
 
- Protected Member Functions inherited from Ipopt::TaggedObject
void ObjectChanged ()
 Objects derived from TaggedObject MUST call this method every time their internal state changes to update the internal tag for comparison. More...
 
- Protected Member Functions inherited from Ipopt::Subject
void Notify (Observer::NotifyType notify_type) const
 

Private Types

enum  Factorization { NONE, LU, CHOL }
 Enum for factorization type. More...
 

Private Member Functions

Default Compiler Generated Methods

(Hidden to avoid implicit creation/calling).

These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called.

 DenseGenMatrix ()
 Default Constructor. More...
 
 DenseGenMatrix (const DenseGenMatrix &)
 Copy Constructor. More...
 
void operator= (const DenseGenMatrix &)
 Overloaded Equals Operator. More...
 

Private Attributes

const DenseGenMatrixSpaceowner_space_
 
Numbervalues_
 Array for storing the matrix elements (one columns after each other) More...
 
bool initialized_
 Flag indicating whether the values_ array has been initialized. More...
 
Factorization factorization_
 Flag indicating if and which factorization has been applied. More...
 
Indexpivot_
 Array for storing the pivot sequences if the matrix has been LU-factorized. More...
 

Additional Inherited Members

- Public Types inherited from Ipopt::TaggedObject
typedef unsigned int Tag
 Type for the Tag values. More...
 

Detailed Description

Class for dense general matrices.

Matrix elements are stored in one array in "Fortran" format.

Definition at line 26 of file IpDenseGenMatrix.hpp.

Member Enumeration Documentation

Enum for factorization type.

Enumerator
NONE 
LU 
CHOL 

Definition at line 192 of file IpDenseGenMatrix.hpp.

Constructor & Destructor Documentation

Ipopt::DenseGenMatrix::DenseGenMatrix ( const DenseGenMatrixSpace owner_space)

Constructor, taking the owner_space.

Ipopt::DenseGenMatrix::~DenseGenMatrix ( )

Destructor.

Ipopt::DenseGenMatrix::DenseGenMatrix ( )
private

Default Constructor.

Ipopt::DenseGenMatrix::DenseGenMatrix ( const DenseGenMatrix )
private

Copy Constructor.

Member Function Documentation

SmartPtr< DenseGenMatrix > Ipopt::DenseGenMatrix::MakeNewDenseGenMatrix ( ) const
inline

Create a new DenseGenMatrix from same MatrixSpace.

Definition at line 239 of file IpDenseGenMatrix.hpp.

Number* Ipopt::DenseGenMatrix::Values ( )
inline

Retrieve the array for storing the matrix elements.

This is the non-const version, and it is assume that afterwards the calling method will set all matrix elements. The matrix elements are stored one column after each other.

Definition at line 48 of file IpDenseGenMatrix.hpp.

const Number* Ipopt::DenseGenMatrix::Values ( ) const
inline

Retrieve the array that stores the matrix elements.

This is the const version, i.e., read-only. The matrix elements are stored one column after each other.

Definition at line 58 of file IpDenseGenMatrix.hpp.

void Ipopt::DenseGenMatrix::Copy ( const DenseGenMatrix M)

Method for copying the content of another matrix into this matrix.

void Ipopt::DenseGenMatrix::FillIdentity ( Number  factor = 1.)

Set this matrix to be a multiple of the identity matrix .

This assumes that this matrix is square.

void Ipopt::DenseGenMatrix::ScaleColumns ( const DenseVector scal_vec)

Method for scaling the columns of the matrix.

The scaling factors are given in form of a DenseVector

void Ipopt::DenseGenMatrix::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 Ipopt::DenseGenMatrix::HighRankUpdateTranspose ( Number  alpha,
const MultiVectorMatrix V1,
const MultiVectorMatrix V2,
Number  beta 
)

Method for adding a high-rank update to this matrix.

It computes M = alpha*V1^T V2 + beta*M, where V1 and V2 are MultiVectorMatrices.

bool Ipopt::DenseGenMatrix::ComputeCholeskyFactor ( const DenseSymMatrix M)

Method for computing the Cholesky factorization of a positive definite matrix.

The factor is stored in this matrix, as lower-triangular matrix, i.e., M = J * J^T. The return values is false if the factorization could not be done, e.g., when the matrix is not positive definite.

bool Ipopt::DenseGenMatrix::ComputeEigenVectors ( const DenseSymMatrix M,
DenseVector Evalues 
)

Method for computing an eigenvalue decomposition of the given symmetrix matrix M.

On return, this matrix contains the eigenvalues in its columns, and Evalues contains the eigenvalues. The return value is false, if there problems during the computation.

void Ipopt::DenseGenMatrix::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 this matrix is square and contains a lower triangular matrix.

The incoming right hand side B is overwritten with the solution X of op(A)*X = alpha*B. op(A) = A or op(A) = A^T.

void Ipopt::DenseGenMatrix::CholeskySolveVector ( DenseVector b) const

Method for performing a solve of a linear system for one vector, assuming that this matrix contains the Cholesky factor for the linear system.

The vector b contains the right hand side on input, and contains the solution on output.

void Ipopt::DenseGenMatrix::CholeskySolveMatrix ( DenseGenMatrix B) const

Method for performing a solve of a linear system for one right-hand-side matrix, assuming that this matrix contains the Cholesky factor for the linear system.

The matrix B contains the right hand sides on input, and contains the solution on output.

bool Ipopt::DenseGenMatrix::ComputeLUFactorInPlace ( )

Method for computing the LU factorization of an unsymmetric matrix.

The factorization is done in place.

void Ipopt::DenseGenMatrix::LUSolveMatrix ( DenseGenMatrix B) const

Method for using a previously computed LU factorization for a backsolve with a matrix on the rhs.

void Ipopt::DenseGenMatrix::LUSolveVector ( DenseVector b) const

Method for using a previously computed LU fatorization for a backsolve with a single vector.

virtual void Ipopt::DenseGenMatrix::MultVectorImpl ( Number  alpha,
const Vector x,
Number  beta,
Vector y 
) const
protectedvirtual

Matrix-vector multiply.

Computes y = alpha * Matrix * x + beta * y

Implements Ipopt::Matrix.

virtual void Ipopt::DenseGenMatrix::TransMultVectorImpl ( Number  alpha,
const Vector x,
Number  beta,
Vector y 
) const
protectedvirtual

Matrix(transpose) vector multiply.

Computes y = alpha * Matrix^T * x + beta * y

Implements Ipopt::Matrix.

virtual bool Ipopt::DenseGenMatrix::HasValidNumbersImpl ( ) const
protectedvirtual

Method for determining if all stored numbers are valid (i.e., no Inf or Nan).

Reimplemented from Ipopt::Matrix.

virtual void Ipopt::DenseGenMatrix::ComputeRowAMaxImpl ( Vector rows_norms,
bool  init 
) const
protectedvirtual

Compute the max-norm of the rows in the matrix.

The result is stored in rows_norms. The vector is assumed to be initialized.

Implements Ipopt::Matrix.

virtual void Ipopt::DenseGenMatrix::ComputeColAMaxImpl ( Vector cols_norms,
bool  init 
) const
protectedvirtual

Compute the max-norm of the columns in the matrix.

The result is stored in cols_norms. The vector is assumed to be initialized.

Implements Ipopt::Matrix.

virtual void Ipopt::DenseGenMatrix::PrintImpl ( const Journalist jnlst,
EJournalLevel  level,
EJournalCategory  category,
const std::string &  name,
Index  indent,
const std::string &  prefix 
) const
protectedvirtual

Print detailed information about the matrix.

Implements Ipopt::Matrix.

void Ipopt::DenseGenMatrix::operator= ( const DenseGenMatrix )
private

Overloaded Equals Operator.

Member Data Documentation

const DenseGenMatrixSpace* Ipopt::DenseGenMatrix::owner_space_
private

Definition at line 182 of file IpDenseGenMatrix.hpp.

Number* Ipopt::DenseGenMatrix::values_
private

Array for storing the matrix elements (one columns after each other)

Definition at line 186 of file IpDenseGenMatrix.hpp.

bool Ipopt::DenseGenMatrix::initialized_
private

Flag indicating whether the values_ array has been initialized.

Definition at line 189 of file IpDenseGenMatrix.hpp.

Factorization Ipopt::DenseGenMatrix::factorization_
private

Flag indicating if and which factorization has been applied.

Definition at line 200 of file IpDenseGenMatrix.hpp.

Index* Ipopt::DenseGenMatrix::pivot_
private

Array for storing the pivot sequences if the matrix has been LU-factorized.

Definition at line 203 of file IpDenseGenMatrix.hpp.


The documentation for this class was generated from the following file: