#include <IpDenseVector.hpp>
Public Member Functions | |
Constructors / Destructors | |
DenseVector (const DenseVectorSpace *owner_space) | |
Default Constructor. | |
virtual | ~DenseVector () |
Destructor. | |
Additional public methods not in Vector base class. | |
SmartPtr< DenseVector > | MakeNewDenseVector () const |
Create a new DenseVector from same VectorSpace. | |
void | SetValues (const Number *x) |
Set elements in the vector to the Number array x. | |
Number * | Values () |
Obtain pointer to the internal Number array with vector elements with the indention to change the vector data (USE WITH CARE!). | |
const Number * | Values () const |
Obtain pointer to the internal Number array with vector elements without the intention to change the vector data (USE WITH CARE!). | |
bool | IsHomogeneous () const |
Indicates if the vector is homogeneous (i.e., all entries have the value Scalar(). | |
Number | Scalar () const |
Scalar value of all entries in a homogeneous vector. | |
Modifying subranges of the vector. | |
void | CopyToPos (Index Pos, const Vector &x) |
Copy the data in x into the subrange of this vector starting at position Pos in this vector. | |
void | CopyFromPos (Index Pos, Vector &x) const |
Copy the data in this vector's subrange starting at position Pos to Vector x. | |
Protected Member Functions | |
Overloaded methods from Vector base class | |
virtual void | CopyImpl (const Vector &x) |
Copy the data of the vector x into this vector (DCOPY). | |
virtual void | ScalImpl (Number alpha) |
Scales the vector by scalar alpha (DSCAL). | |
virtual void | AxpyImpl (Number alpha, const Vector &x) |
Add the multiple alpha of vector x to this vector (DAXPY). | |
virtual Number | DotImpl (const Vector &x) const |
Computes inner product of vector x with this (DDOT). | |
virtual Number | Nrm2Impl () const |
Computes the 2-norm of this vector (DNRM2). | |
virtual Number | AsumImpl () const |
Computes the 1-norm of this vector (DASUM). | |
virtual Number | AmaxImpl () const |
Computes the max-norm of this vector (based on IDAMAX). | |
virtual void | SetImpl (Number value) |
Set each element in the vector to the scalar alpha. | |
virtual void | ElementWiseDivideImpl (const Vector &x) |
Element-wise division . | |
virtual void | ElementWiseMultiplyImpl (const Vector &x) |
Element-wise multiplication . | |
virtual void | ElementWiseMaxImpl (const Vector &x) |
Set entry to max of itself and the corresponding element in x. | |
virtual void | ElementWiseMinImpl (const Vector &x) |
Set entry to min of itself and the corresponding element in x. | |
virtual void | ElementWiseReciprocalImpl () |
reciprocates the elements of the vector | |
virtual void | ElementWiseAbsImpl () |
take abs of the elements of the vector | |
virtual void | ElementWiseSqrtImpl () |
take square-root of the elements of the vector | |
virtual void | ElementWiseSgnImpl () |
Changes each entry in the vector to its sgn value. | |
virtual void | AddScalarImpl (Number scalar) |
Add scalar to every component of the vector. | |
virtual Number | MaxImpl () const |
Max value in the vector. | |
virtual Number | MinImpl () const |
Min value in the vector. | |
virtual Number | SumImpl () const |
Computes the sum of the lements of vector. | |
virtual Number | SumLogsImpl () const |
Computes the sum of the logs of the elements of vector. | |
Implemented specialized functions | |
void | AddTwoVectorsImpl (Number a, const Vector &v1, Number b, const Vector &v2, Number c) |
Add two vectors (a * v1 + b * v2). | |
Number | FracToBoundImpl (const Vector &delta, Number tau) const |
Fraction to the boundary parameter. | |
void | AddVectorQuotientImpl (Number a, const Vector &z, const Vector &s, Number c) |
Add the quotient of two vectors, y = a * z/s + c * y. | |
Output methods | |
virtual void | PrintImpl (const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const |
Print the entire vector. |
DenseVector | ( | const DenseVectorSpace * | owner_space | ) |
~DenseVector | ( | ) | [virtual] |
SmartPtr< DenseVector > MakeNewDenseVector | ( | ) | const [inline] |
void SetValues | ( | const Number * | x | ) |
Set elements in the vector to the Number array x.
References Vector::Dim(), Ipopt::IpBlasDcopy(), and TaggedObject::ObjectChanged().
Number * Values | ( | ) | [inline] |
Obtain pointer to the internal Number array with vector elements with the indention to change the vector data (USE WITH CARE!).
This does not produce a copy, and lifetime is not guaranteed!
References TaggedObject::ObjectChanged().
Referenced by ExpansionMatrix::AddMSinvZImpl(), DenseGenMatrix::CholeskySolveVector(), DenseGenMatrix::ComputeEigenVectors(), TNLPAdapter::Eval_c(), TNLPAdapter::Eval_d(), TNLPAdapter::Eval_grad_f(), TNLPAdapter::FinalizeSolution(), TNLPAdapter::GetBoundsInformation(), TNLPAdapter::GetScalingParameters(), TNLPAdapter::GetStartingPoint(), SymTMatrix::MultVectorImpl(), MultiVectorMatrix::MultVectorImpl(), GenTMatrix::MultVectorImpl(), ExpansionMatrix::MultVectorImpl(), DenseSymMatrix::MultVectorImpl(), DenseGenMatrix::MultVectorImpl(), DenseGenMatrix::ScaleColumns(), ExpansionMatrix::SinvBlrmZMTdBrImpl(), DenseSymMatrix::SpecialAddForLMSR1(), GenTMatrix::TransMultVectorImpl(), ExpansionMatrix::TransMultVectorImpl(), and DenseGenMatrix::TransMultVectorImpl().
const Number * Values | ( | ) | const [inline] |
Obtain pointer to the internal Number array with vector elements without the intention to change the vector data (USE WITH CARE!).
This does not produce a copy, and lifetime is not guaranteed!
References DBG_ASSERT, and Vector::Dim().
bool IsHomogeneous | ( | ) | const [inline] |
Indicates if the vector is homogeneous (i.e., all entries have the value Scalar().
Referenced by ExpansionMatrix::AddMSinvZImpl(), TNLPAdapter::FinalizeSolution(), SymTMatrix::MultVectorImpl(), MultiVectorMatrix::MultVectorImpl(), GenTMatrix::MultVectorImpl(), ExpansionMatrix::MultVectorImpl(), ExpansionMatrix::SinvBlrmZMTdBrImpl(), GenTMatrix::TransMultVectorImpl(), and ExpansionMatrix::TransMultVectorImpl().
Number Scalar | ( | ) | const [inline] |
Scalar value of all entries in a homogeneous vector.
References DBG_ASSERT.
Referenced by ExpansionMatrix::AddMSinvZImpl(), SymTMatrix::MultVectorImpl(), MultiVectorMatrix::MultVectorImpl(), GenTMatrix::MultVectorImpl(), ExpansionMatrix::MultVectorImpl(), ExpansionMatrix::SinvBlrmZMTdBrImpl(), GenTMatrix::TransMultVectorImpl(), and ExpansionMatrix::TransMultVectorImpl().
Copy the data in x into the subrange of this vector starting at position Pos in this vector.
Position count starts at 0.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, Ipopt::IpBlasDcopy(), TaggedObject::ObjectChanged(), and DenseVector::values_.
Copy the data in this vector's subrange starting at position Pos to Vector x.
Position count starts at 0.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, DenseVector::initialized_, Ipopt::IpBlasDcopy(), TaggedObject::ObjectChanged(), and DenseVector::values_.
void CopyImpl | ( | const Vector & | x | ) | [protected, virtual] |
Copy the data of the vector x into this vector (DCOPY).
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::Dim(), DenseVector::homogeneous_, DenseVector::initialized_, Ipopt::IpBlasDcopy(), DenseVector::scalar_, and DenseVector::values_.
void ScalImpl | ( | Number | alpha | ) | [protected, virtual] |
Scales the vector by scalar alpha (DSCAL).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and Ipopt::IpBlasDscal().
Add the multiple alpha of vector x to this vector (DAXPY).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, Ipopt::IpBlasDaxpy(), DenseVector::scalar_, and DenseVector::values_.
Computes inner product of vector x with this (DDOT).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, DenseVector::initialized_, Ipopt::IpBlasDdot(), DenseVector::scalar_, and DenseVector::values_.
Number Nrm2Impl | ( | ) | const [protected, virtual] |
Computes the 2-norm of this vector (DNRM2).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and Ipopt::IpBlasDnrm2().
Number AsumImpl | ( | ) | const [protected, virtual] |
Computes the 1-norm of this vector (DASUM).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and Ipopt::IpBlasDasum().
Number AmaxImpl | ( | ) | const [protected, virtual] |
Computes the max-norm of this vector (based on IDAMAX).
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and Ipopt::IpBlasIdamax().
void SetImpl | ( | Number | value | ) | [protected, virtual] |
Set each element in the vector to the scalar alpha.
Implements Vector.
References DenseVectorSpace::FreeInternalStorage().
void ElementWiseDivideImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise division .
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, DenseVector::scalar_, and DenseVector::values_.
void ElementWiseMultiplyImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise multiplication .
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, DenseVector::scalar_, and DenseVector::values_.
void ElementWiseMaxImpl | ( | const Vector & | x | ) | [protected, virtual] |
Set entry to max of itself and the corresponding element in x.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, Ipopt::Max(), DenseVector::scalar_, and DenseVector::values_.
void ElementWiseMinImpl | ( | const Vector & | x | ) | [protected, virtual] |
Set entry to min of itself and the corresponding element in x.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, Ipopt::Min(), DenseVector::scalar_, and DenseVector::values_.
void ElementWiseReciprocalImpl | ( | ) | [protected, virtual] |
reciprocates the elements of the vector
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and fkinkryx::i.
void ElementWiseAbsImpl | ( | ) | [protected, virtual] |
take abs of the elements of the vector
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and fkinkryx::i.
void ElementWiseSqrtImpl | ( | ) | [protected, virtual] |
take square-root of the elements of the vector
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and fkinkryx::i.
void ElementWiseSgnImpl | ( | ) | [protected, virtual] |
Changes each entry in the vector to its sgn value.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and fkinkryx::i.
void AddScalarImpl | ( | Number | scalar | ) | [protected, virtual] |
Add scalar to every component of the vector.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), and Ipopt::IpBlasDaxpy().
Number MaxImpl | ( | ) | const [protected, virtual] |
Max value in the vector.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), fkinkryx::i, Ipopt::Max(), and SimTK::max().
Number MinImpl | ( | ) | const [protected, virtual] |
Min value in the vector.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), fkinkryx::i, Ipopt::Min(), and SimTK::min().
Number SumImpl | ( | ) | const [protected, virtual] |
Computes the sum of the lements of vector.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), fkinkryx::i, and SimTK::sum().
Number SumLogsImpl | ( | ) | const [protected, virtual] |
Computes the sum of the logs of the elements of vector.
Implements Vector.
References DBG_ASSERT, Vector::Dim(), fkinkryx::i, and SimTK::sum().
void AddTwoVectorsImpl | ( | Number | a, | |
const Vector & | v1, | |||
Number | b, | |||
const Vector & | v2, | |||
Number | c | |||
) | [protected, virtual] |
Add two vectors (a * v1 + b * v2).
Result is stored in this vector.
Reimplemented from Vector.
References Vector::AddTwoVectorsImpl(), DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, DenseVector::scalar_, and DenseVector::values_.
Fraction to the boundary parameter.
Reimplemented from Vector.
References alpha, DBG_ASSERT, Vector::Dim(), DenseVector::homogeneous_, fkinkryx::i, Ipopt::Min(), DenseVector::scalar_, and DenseVector::values_.
void AddVectorQuotientImpl | ( | Number | a, | |
const Vector & | z, | |||
const Vector & | s, | |||
Number | c | |||
) | [protected, virtual] |
Add the quotient of two vectors, y = a * z/s + c * y.
Reimplemented from Vector.
References DBG_ASSERT, Vector::Dim(), DenseVectorSpace::FreeInternalStorage(), DenseVector::homogeneous_, fkinkryx::i, DenseVector::initialized_, DenseVector::scalar_, and DenseVector::values_.
void PrintImpl | ( | const Journalist & | jnlst, | |
EJournalLevel | level, | |||
EJournalCategory | category, | |||
const std::string & | name, | |||
Index | indent, | |||
const std::string & | prefix | |||
) | const [protected, virtual] |
Print the entire vector.
Implements Vector.
References Vector::Dim(), fkinkryx::i, and Journalist::PrintfIndented().