#include <IpDenseGenMatrix.hpp>
Matrix elements are stored in one array in "Fortran" format.
Public Member Functions | |
SmartPtr< DenseGenMatrix > | MakeNewDenseGenMatrix () const |
Create a new DenseGenMatrix from same MatrixSpace. | |
Number * | Values () |
Retrieve the array for storing the matrix elements. | |
const Number * | Values () const |
Retrieve the array that stores the matrix elements. | |
void | Copy (const DenseGenMatrix &M) |
Method for copying the content of another matrix into this matrix. | |
void | FillIdentity (Number factor=1.) |
Set this matrix to be a multiple of the identity matrix . | |
void | ScaleColumns (const DenseVector &scal_vec) |
Method for scaling the columns of the matrix. | |
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 | HighRankUpdateTranspose (Number alpha, const MultiVectorMatrix &V1, const MultiVectorMatrix &V2, Number beta) |
Method for adding a high-rank update to this matrix. | |
bool | ComputeCholeskyFactor (const DenseSymMatrix &M) |
Method for computing the Cholesky factorization of a positive definite matrix. | |
bool | ComputeEigenVectors (const DenseSymMatrix &M, DenseVector &Evalues) |
Method for computing an eigenvalue decomposition of the given symmetrix matrix M. | |
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. | |
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. | |
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. | |
Constructors / Destructors | |
DenseGenMatrix (const DenseGenMatrixSpace *owner_space) | |
Constructor, taking the owner_space. | |
~DenseGenMatrix () | |
Destructor. | |
Protected Member Functions | |
Overloaded methods from Matrix base class | |
virtual void | MultVectorImpl (Number alpha, const Vector &x, Number beta, Vector &y) const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). | |
virtual void | TransMultVectorImpl (Number alpha, const Vector &x, Number beta, Vector &y) const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). | |
virtual bool | HasValidNumbersImpl () const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). | |
virtual void | PrintImpl (const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). |
DenseGenMatrix | ( | const DenseGenMatrixSpace * | owner_space | ) |
Constructor, taking the owner_space.
~DenseGenMatrix | ( | ) |
Destructor.
SmartPtr< DenseGenMatrix > MakeNewDenseGenMatrix | ( | ) | const [inline] |
Create a new DenseGenMatrix from same MatrixSpace.
References DenseGenMatrixSpace::MakeNewDenseGenMatrix().
Number* 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.
References TaggedObject::ObjectChanged().
Referenced by DenseGenMatrix::AddMatrixProduct(), MultiVectorMatrix::AddRightMultMatrix(), DenseGenMatrix::CholeskyBackSolveMatrix(), DenseGenMatrix::CholeskySolveMatrix(), DenseGenMatrix::Copy(), DenseSymMatrix::HighRankUpdate(), and DenseSymMatrix::SpecialAddForLMSR1().
const Number* 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.
References DBG_ASSERT.
void Copy | ( | const DenseGenMatrix & | M | ) |
Method for copying the content of another matrix into this matrix.
References DBG_ASSERT, Ipopt::IpBlasDcopy(), Matrix::NCols(), Matrix::NRows(), TaggedObject::ObjectChanged(), and DenseGenMatrix::Values().
void FillIdentity | ( | Number | factor = 1. |
) |
Set this matrix to be a multiple of the identity matrix .
This assumes that this matrix is square.
References DBG_ASSERT, fkinkryx::i, Ipopt::IpBlasDcopy(), Matrix::NCols(), Matrix::NRows(), and TaggedObject::ObjectChanged().
void ScaleColumns | ( | const DenseVector & | scal_vec | ) |
Method for scaling the columns of the matrix.
The scaling factors are given in form of a DenseVector
References DBG_ASSERT, Vector::Dim(), Ipopt::IpBlasDscal(), Matrix::NCols(), Matrix::NRows(), TaggedObject::ObjectChanged(), and DenseVector::Values().
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.
References DBG_ASSERT, Ipopt::IpBlasDgemm(), k, m, n, Matrix::NCols(), Matrix::NRows(), TaggedObject::ObjectChanged(), and DenseGenMatrix::Values().
void 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.
References DBG_ASSERT, MultiVectorMatrix::GetVector(), fkinkryx::i, Matrix::NCols(), Matrix::NRows(), and TaggedObject::ObjectChanged().
bool 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.
References DBG_ASSERT, SymMatrix::Dim(), fkinkryx::i, info, Ipopt::IpLapackDpotrf(), Matrix::NCols(), Matrix::NRows(), TaggedObject::ObjectChanged(), and DenseSymMatrix::Values().
bool 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.
References DBG_ASSERT, Vector::Dim(), SymMatrix::Dim(), fkinkryx::i, info, Ipopt::IpLapackDsyev(), Matrix::NCols(), Matrix::NRows(), TaggedObject::ObjectChanged(), DenseVector::Values(), and DenseSymMatrix::Values().
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.
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.
References DBG_ASSERT, Ipopt::IpBlasDtrsm(), Matrix::NCols(), Matrix::NRows(), and DenseGenMatrix::Values().
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.
The vector b contains the right hand side on input, and contains the solution on output.
References DBG_ASSERT, Vector::Dim(), Ipopt::IpLapackDpotrs(), Matrix::NCols(), Matrix::NRows(), and DenseVector::Values().
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.
The matrix B contains the right hand sides on input, and contains the solution on output.
References DBG_ASSERT, Ipopt::IpLapackDpotrs(), Matrix::NCols(), Matrix::NRows(), and DenseGenMatrix::Values().
void MultVectorImpl | ( | Number | alpha, | |
const Vector & | x, | |||
Number | beta, | |||
Vector & | y | |||
) | const [protected, virtual] |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Implements Matrix.
References DBG_ASSERT, Vector::Dim(), Ipopt::IpBlasDgemv(), Matrix::NCols(), Matrix::NRows(), trans, and DenseVector::Values().
void TransMultVectorImpl | ( | Number | alpha, | |
const Vector & | x, | |||
Number | beta, | |||
Vector & | y | |||
) | const [protected, virtual] |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Implements Matrix.
References DBG_ASSERT, Vector::Dim(), Ipopt::IpBlasDgemv(), Matrix::NCols(), Matrix::NRows(), trans, and DenseVector::Values().
bool HasValidNumbersImpl | ( | ) | const [protected, virtual] |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Reimplemented from Matrix.
References DBG_ASSERT, Ipopt::IpBlasDasum(), Ipopt::IsFiniteNumber(), Matrix::NCols(), Matrix::NRows(), and SimTK::sum().
void PrintImpl | ( | const Journalist & | jnlst, | |
EJournalLevel | level, | |||
EJournalCategory | category, | |||
const std::string & | name, | |||
Index | indent, | |||
const std::string & | prefix | |||
) | const [protected, virtual] |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Implements Matrix.
References fkinkryx::i, Matrix::NCols(), Matrix::NRows(), Journalist::Printf(), and Journalist::PrintfIndented().