#include <IpCompoundVector.hpp>
This vector is a vector that consists of zero, one or more Vector's which are stacked on each others: . The individual components can be associated to different VectorSpaces. The individual components can also be const and non-const Vectors.
Public Member Functions | |
void | SetComp (Index icomp, const Vector &vec) |
Method for setting the pointer for a component that is a const Vector. | |
void | SetCompNonConst (Index icomp, Vector &vec) |
Method for setting the pointer for a component that is a non-const Vector. | |
Index | NComps () const |
Number of components of this compound vector. | |
bool | IsCompConst (Index i) const |
Check if a particular component is const or not. | |
bool | IsCompNull (Index i) const |
Check if a particular component is null or not. | |
SmartPtr< const Vector > | GetComp (Index i) const |
Return a particular component (const version). | |
SmartPtr< Vector > | GetCompNonConst (Index i) |
Return a particular component (non-const version). | |
Constructors/Destructors | |
CompoundVector (const CompoundVectorSpace *owner_space, bool create_new) | |
Constructor, given the corresponding CompoundVectorSpace. | |
virtual | ~CompoundVector () |
Default destructor. | |
Protected Member Functions | |
virtual bool | HasValidNumbersImpl () const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). | |
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) |
Element-wise max against entries in x. | |
virtual void | ElementWiseMinImpl (const Vector &x) |
Element-wise min against entries in x. | |
virtual void | ElementWiseReciprocalImpl () |
Element-wise reciprocal. | |
virtual void | ElementWiseAbsImpl () |
Element-wise absolute values. | |
virtual void | ElementWiseSqrtImpl () |
Element-wise square-root. | |
virtual void | ElementWiseSgnImpl () |
Replaces entries with sgn of the entry. | |
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. |
CompoundVector | ( | const CompoundVectorSpace * | owner_space, | |
bool | create_new | |||
) |
Constructor, given the corresponding CompoundVectorSpace.
Before this constructor can be called, all components of the CompoundVectorSpace have to be set, so that the constructors for the individual components can be called. If the flag create_new is true, then the individual components of the new CompoundVector are initialized with the MakeNew methods of each VectorSpace (and are non-const). Otherwise, the individual components can later be set using the SetComp and SetCompNonConst method.
References DBG_ASSERT, Vector::Dim(), CompoundVectorSpace::GetCompSpace(), fkinkryx::i, Ipopt::IsValid(), and CompoundVector::NComps().
~CompoundVector | ( | ) | [virtual] |
Default destructor.
Method for setting the pointer for a component that is a const Vector.
References DBG_ASSERT, CompoundVector::NComps(), and TaggedObject::ObjectChanged().
Referenced by IteratesVector::Set_bound_mult(), IteratesVector::Set_eq_mult(), IteratesVector::Set_primal(), IteratesVector::Set_s(), IteratesVector::Set_v_L(), IteratesVector::Set_v_U(), IteratesVector::Set_x(), IteratesVector::Set_y_c(), IteratesVector::Set_y_d(), IteratesVector::Set_z_L(), and IteratesVector::Set_z_U().
Method for setting the pointer for a component that is a non-const Vector.
References DBG_ASSERT, CompoundVector::NComps(), and TaggedObject::ObjectChanged().
Referenced by IteratesVector::Set_bound_mult_NonConst(), IteratesVector::Set_eq_mult_NonConst(), IteratesVector::Set_primal_NonConst(), IteratesVector::Set_s_NonConst(), IteratesVector::Set_v_L_NonConst(), IteratesVector::Set_v_U_NonConst(), IteratesVector::Set_x_NonConst(), IteratesVector::Set_y_c_NonConst(), IteratesVector::Set_y_d_NonConst(), IteratesVector::Set_z_L_NonConst(), and IteratesVector::Set_z_U_NonConst().
Index NComps | ( | ) | const [inline] |
Number of components of this compound vector.
References CompoundVectorSpace::NCompSpaces().
Referenced by CompoundMatrix::AddMSinvZImpl(), CompoundVector::AddScalarImpl(), CompoundVector::AddTwoVectorsImpl(), CompoundVector::AddVectorQuotientImpl(), CompoundVector::AmaxImpl(), CompoundVector::AsumImpl(), CompoundVector::AxpyImpl(), CompoundVector::CompoundVector(), CompoundVector::CopyImpl(), CompoundVector::DotImpl(), CompoundVector::ElementWiseAbsImpl(), CompoundVector::ElementWiseDivideImpl(), CompoundVector::ElementWiseMaxImpl(), CompoundVector::ElementWiseMinImpl(), CompoundVector::ElementWiseMultiplyImpl(), CompoundVector::ElementWiseReciprocalImpl(), CompoundVector::ElementWiseSgnImpl(), CompoundVector::ElementWiseSqrtImpl(), TripletHelper::FillValuesFromVector(), CompoundVector::FracToBoundImpl(), CompoundVector::HasValidNumbersImpl(), CompoundVector::IsCompConst(), CompoundVector::IsCompNull(), CompoundVector::MaxImpl(), CompoundVector::MinImpl(), CompoundSymMatrix::MultVectorImpl(), CompoundMatrix::MultVectorImpl(), CompoundVector::Nrm2Impl(), CompoundVector::PrintImpl(), TripletHelper::PutValuesInVector(), CompoundVector::ScalImpl(), CompoundVector::SetComp(), CompoundVector::SetCompNonConst(), CompoundVector::SetImpl(), CompoundMatrix::SinvBlrmZMTdBrImpl(), CompoundVector::SumImpl(), CompoundVector::SumLogsImpl(), and CompoundMatrix::TransMultVectorImpl().
bool IsCompConst | ( | Index | i | ) | const [inline] |
Check if a particular component is const or not.
References DBG_ASSERT, Ipopt::IsValid(), and CompoundVector::NComps().
bool IsCompNull | ( | Index | i | ) | const [inline] |
Check if a particular component is null or not.
References DBG_ASSERT, Ipopt::IsValid(), and CompoundVector::NComps().
Return a particular component (const version).
Referenced by CompoundMatrix::AddMSinvZImpl(), CompoundVector::AddTwoVectorsImpl(), CompoundVector::AddVectorQuotientImpl(), RestoIpoptNLP::AdjustVariableBounds(), CompoundVector::AxpyImpl(), RestoIpoptNLP::c(), RestoFilterConvergenceCheck::CheckConvergence(), CompoundVector::CopyImpl(), IteratesVector::create_new_s_copy(), IteratesVector::create_new_v_L_copy(), IteratesVector::create_new_v_U_copy(), IteratesVector::create_new_x_copy(), IteratesVector::create_new_y_c_copy(), IteratesVector::create_new_y_d_copy(), IteratesVector::create_new_z_L_copy(), IteratesVector::create_new_z_U_copy(), RestoIpoptNLP::d(), CompoundVector::DotImpl(), CompoundVector::ElementWiseDivideImpl(), CompoundVector::ElementWiseMaxImpl(), CompoundVector::ElementWiseMinImpl(), CompoundVector::ElementWiseMultiplyImpl(), RestoIpoptNLP::f(), TripletHelper::FillValuesFromVector(), CompoundVector::FracToBoundImpl(), RestoIpoptNLP::grad_f(), RestoIpoptNLP::h(), RestoIpoptNLP::jac_c(), RestoIpoptNLP::jac_d(), CompoundSymMatrix::MultVectorImpl(), CompoundMatrix::MultVectorImpl(), CompoundMatrix::SinvBlrmZMTdBrImpl(), CompoundMatrix::TransMultVectorImpl(), LimMemQuasiNewtonUpdater::UpdateHessian(), and RestoIterationOutput::WriteOutput().
Return a particular component (non-const version).
Note that calling this method with mark the CompoundVector as changed. Therefore, only use this method if you are intending to change the Vector that you receive.
References TaggedObject::ObjectChanged().
Referenced by CompoundMatrix::AddMSinvZImpl(), RestoIpoptNLP::grad_f(), CompoundSymMatrix::MultVectorImpl(), CompoundMatrix::MultVectorImpl(), TripletHelper::PutValuesInVector(), CompoundMatrix::SinvBlrmZMTdBrImpl(), and CompoundMatrix::TransMultVectorImpl().
void CopyImpl | ( | const Vector & | x | ) | [protected, virtual] |
Copy the data of the vector x into this vector (DCOPY).
Implements Vector.
References Vector::Copy(), DBG_ASSERT, DBG_START_METH, CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
void ScalImpl | ( | Number | alpha | ) | [protected, virtual] |
Scales the vector by scalar alpha (DSCAL).
Implements Vector.
References DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), and Vector::Scal().
Add the multiple alpha of vector x to this vector (DAXPY).
Implements Vector.
References Vector::Axpy(), DBG_ASSERT, DBG_START_METH, CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
Computes inner product of vector x with this (DDOT).
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::Dot(), SimTK::dot(), CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
Number Nrm2Impl | ( | ) | const [protected, virtual] |
Computes the 2-norm of this vector (DNRM2).
Implements Vector.
References DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), Vector::Nrm2(), and SimTK::sum().
Number AsumImpl | ( | ) | const [protected, virtual] |
Computes the 1-norm of this vector (DASUM).
Implements Vector.
References Vector::Asum(), DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), and SimTK::sum().
Number AmaxImpl | ( | ) | const [protected, virtual] |
Computes the max-norm of this vector (based on IDAMAX).
Implements Vector.
References Vector::Amax(), DBG_ASSERT, DBG_START_METH, fkinkryx::i, Ipopt::Max(), SimTK::max(), and CompoundVector::NComps().
void SetImpl | ( | Number | value | ) | [protected, virtual] |
Set each element in the vector to the scalar alpha.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), and Vector::Set().
void ElementWiseDivideImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise division .
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseDivide(), CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseMultiplyImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise multiplication .
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseMultiply(), CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseMaxImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise max against entries in x.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseMax(), CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseMinImpl | ( | const Vector & | x | ) | [protected, virtual] |
Element-wise min against entries in x.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseMin(), CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseReciprocalImpl | ( | ) | [protected, virtual] |
Element-wise reciprocal.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseReciprocal(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseAbsImpl | ( | ) | [protected, virtual] |
Element-wise absolute values.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseAbs(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseSqrtImpl | ( | ) | [protected, virtual] |
Element-wise square-root.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseSqrt(), fkinkryx::i, and CompoundVector::NComps().
void ElementWiseSgnImpl | ( | ) | [protected, virtual] |
Replaces entries with sgn of the entry.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::ElementWiseSgn(), fkinkryx::i, and CompoundVector::NComps().
void AddScalarImpl | ( | Number | scalar | ) | [protected, virtual] |
Add scalar to every component of the vector.
Implements Vector.
References Vector::AddScalar(), DBG_ASSERT, DBG_START_METH, fkinkryx::i, and CompoundVector::NComps().
Number MaxImpl | ( | ) | const [protected, virtual] |
Max value in the vector.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::Dim(), fkinkryx::i, Vector::Max(), Ipopt::Max(), SimTK::max(), and CompoundVector::NComps().
Number MinImpl | ( | ) | const [protected, virtual] |
Min value in the vector.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, Vector::Dim(), fkinkryx::i, SimTK::max(), Vector::Min(), Ipopt::Min(), SimTK::min(), and CompoundVector::NComps().
Number SumImpl | ( | ) | const [protected, virtual] |
Computes the sum of the lements of vector.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), Vector::Sum(), and SimTK::sum().
Number SumLogsImpl | ( | ) | const [protected, virtual] |
Computes the sum of the logs of the elements of vector.
Implements Vector.
References DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), SimTK::sum(), and Vector::SumLogs().
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::AddTwoVectors(), DBG_ASSERT, CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
Fraction to the boundary parameter.
Reimplemented from Vector.
References alpha, DBG_ASSERT, Vector::FracToBound(), CompoundVector::GetComp(), fkinkryx::i, Ipopt::Min(), and CompoundVector::NComps().
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 Vector::AddVectorQuotient(), DBG_ASSERT, CompoundVector::GetComp(), fkinkryx::i, and CompoundVector::NComps().
bool HasValidNumbersImpl | ( | ) | const [protected, virtual] |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Reimplemented from Vector.
References DBG_ASSERT, Vector::HasValidNumbers(), fkinkryx::i, and CompoundVector::NComps().
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 DBG_ASSERT, DBG_START_METH, fkinkryx::i, CompoundVector::NComps(), Vector::Print(), Journalist::Printf(), and Journalist::PrintfIndented().