CompoundVector Class Reference

#include <IpCompoundVector.hpp>

Inheritance diagram for CompoundVector:

Vector TaggedObject ReferencedObject Subject IteratesVector

List of all members.


Detailed Description

Class of Vectors consisting of other vectors.

This vector is a vector that consists of zero, one or more Vector's which are stacked on each others: $ x_{\rm compound} = \left(\begin{array}{c}x_0\\\dots\\x_{{\rm ncomps} - 1}\end{array}\right)$. 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 VectorGetComp (Index i) const
 Return a particular component (const version).
SmartPtr< VectorGetCompNonConst (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 $y_i \gets y_i/x_i$.
virtual void ElementWiseMultiplyImpl (const Vector &x)
 Element-wise multiplication $y_i \gets y_i*x_i$.
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.


Constructor & Destructor Documentation

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.


Member Function Documentation

void SetComp ( Index  icomp,
const Vector vec 
)

void SetCompNonConst ( Index  icomp,
Vector vec 
)

Index NComps (  )  const [inline]

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().

SmartPtr<const Vector> GetComp ( Index  i  )  const [inline]

SmartPtr<Vector> GetCompNonConst ( Index  i  )  [inline]

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().

void AxpyImpl ( Number  alpha,
const Vector x 
) [protected, virtual]

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().

Number DotImpl ( const Vector x  )  const [protected, virtual]

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]

void ElementWiseMultiplyImpl ( const Vector x  )  [protected, virtual]

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]

Number MinImpl (  )  const [protected, virtual]

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().

Number FracToBoundImpl ( const Vector delta,
Number  tau 
) const [protected, virtual]

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]


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

Generated on Fri Sep 26 07:44:25 2008 for SimTKcore by  doxygen 1.5.6