Ipopt::CompoundVector Class Reference

Class of Vectors consisting of other vectors. More...

#include <IpCompoundVector.hpp>

Inheritance diagram for Ipopt::CompoundVector:
Inheritance graph
[legend]
Collaboration diagram for Ipopt::CompoundVector:
Collaboration graph
[legend]

List of all members.

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.

Private Member Functions

bool VectorsValid ()
const VectorConstComp (Index i) const
VectorComp (Index i)
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.



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

Private Attributes

std::vector< SmartPtr< Vector > > comps_
 Components of the compound vector.
std::vector< SmartPtr< const
Vector > > 
const_comps_
const CompoundVectorSpaceowner_space_
 Vector Space.
bool vectors_valid_

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.

Definition at line 30 of file IpCompoundVector.hpp.


Constructor & Destructor Documentation

Ipopt::CompoundVector::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.

virtual Ipopt::CompoundVector::~CompoundVector (  )  [virtual]

Default destructor.

Ipopt::CompoundVector::CompoundVector (  )  [private]

Default Constructor.

Ipopt::CompoundVector::CompoundVector ( const CompoundVector  )  [private]

Copy Constructor.


Member Function Documentation

void Ipopt::CompoundVector::SetComp ( Index  icomp,
const Vector vec 
)

Method for setting the pointer for a component that is a const Vector.

void Ipopt::CompoundVector::SetCompNonConst ( Index  icomp,
Vector vec 
)

Method for setting the pointer for a component that is a non-const Vector.

Index Ipopt::CompoundVector::NComps (  )  const [inline]

Number of components of this compound vector.

Definition at line 308 of file IpCompoundVector.hpp.

bool Ipopt::CompoundVector::IsCompConst ( Index  i  )  const [inline]

Check if a particular component is const or not.

Definition at line 65 of file IpCompoundVector.hpp.

bool Ipopt::CompoundVector::IsCompNull ( Index  i  )  const [inline]

Check if a particular component is null or not.

Definition at line 76 of file IpCompoundVector.hpp.

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

Return a particular component (const version).

Definition at line 86 of file IpCompoundVector.hpp.

SmartPtr<Vector> Ipopt::CompoundVector::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.

Definition at line 96 of file IpCompoundVector.hpp.

virtual void Ipopt::CompoundVector::CopyImpl ( const Vector x  )  [protected, virtual]

Copy the data of the vector x into this vector (DCOPY).

virtual void Ipopt::CompoundVector::ScalImpl ( Number  alpha  )  [protected, virtual]

Scales the vector by scalar alpha (DSCAL).

Implements Ipopt::Vector.

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

Add the multiple alpha of vector x to this vector (DAXPY).

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

Computes inner product of vector x with this (DDOT).

virtual Number Ipopt::CompoundVector::Nrm2Impl (  )  const [protected, virtual]

Computes the 2-norm of this vector (DNRM2).

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::AsumImpl (  )  const [protected, virtual]

Computes the 1-norm of this vector (DASUM).

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::AmaxImpl (  )  const [protected, virtual]

Computes the max-norm of this vector (based on IDAMAX).

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::SetImpl ( Number  value  )  [protected, virtual]

Set each element in the vector to the scalar alpha.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseDivideImpl ( const Vector x  )  [protected, virtual]

Element-wise division $y_i \gets y_i/x_i$.

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

Element-wise multiplication $y_i \gets y_i*x_i$.

virtual void Ipopt::CompoundVector::ElementWiseMaxImpl ( const Vector x  )  [protected, virtual]

Element-wise max against entries in x.

virtual void Ipopt::CompoundVector::ElementWiseMinImpl ( const Vector x  )  [protected, virtual]

Element-wise min against entries in x.

virtual void Ipopt::CompoundVector::ElementWiseReciprocalImpl (  )  [protected, virtual]

Element-wise reciprocal.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseAbsImpl (  )  [protected, virtual]

Element-wise absolute values.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseSqrtImpl (  )  [protected, virtual]

Element-wise square-root.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseSgnImpl (  )  [protected, virtual]

Replaces entries with sgn of the entry.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::AddScalarImpl ( Number  scalar  )  [protected, virtual]

Add scalar to every component of the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::MaxImpl (  )  const [protected, virtual]

Max value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::MinImpl (  )  const [protected, virtual]

Min value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::SumImpl (  )  const [protected, virtual]

Computes the sum of the lements of vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::SumLogsImpl (  )  const [protected, virtual]

Computes the sum of the logs of the elements of vector.

Implements Ipopt::Vector.

void Ipopt::CompoundVector::AddTwoVectorsImpl ( Number  a,
const Vector v1,
Number  b,
const Vector v2,
Number  c 
) [protected]

Add two vectors (a * v1 + b * v2).

Result is stored in this vector.

Number Ipopt::CompoundVector::FracToBoundImpl ( const Vector delta,
Number  tau 
) const [protected]

Fraction to the boundary parameter.

void Ipopt::CompoundVector::AddVectorQuotientImpl ( Number  a,
const Vector z,
const Vector s,
Number  c 
) [protected]

Add the quotient of two vectors, y = a * z/s + c * y.

virtual bool Ipopt::CompoundVector::HasValidNumbersImpl (  )  const [protected, virtual]

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

Reimplemented from Ipopt::Vector.

virtual void Ipopt::CompoundVector::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 Ipopt::Vector.

void Ipopt::CompoundVector::operator= ( const CompoundVector  )  [private]

Overloaded Equals Operator.

Reimplemented from Ipopt::Vector.

Reimplemented in Ipopt::IteratesVector.

bool Ipopt::CompoundVector::VectorsValid (  )  [private]
const Vector * Ipopt::CompoundVector::ConstComp ( Index  i  )  const [inline, private]

Definition at line 314 of file IpCompoundVector.hpp.

Vector * Ipopt::CompoundVector::Comp ( Index  i  )  [inline, private]

Definition at line 330 of file IpCompoundVector.hpp.


Member Data Documentation

std::vector< SmartPtr<Vector> > Ipopt::CompoundVector::comps_ [private]

Components of the compound vector.

The components are stored by SmartPtrs in a std::vector

Definition at line 219 of file IpCompoundVector.hpp.

std::vector< SmartPtr<const Vector> > Ipopt::CompoundVector::const_comps_ [private]

Definition at line 220 of file IpCompoundVector.hpp.

Vector Space.

Reimplemented from Ipopt::Vector.

Reimplemented in Ipopt::IteratesVector.

Definition at line 222 of file IpCompoundVector.hpp.

Definition at line 224 of file IpCompoundVector.hpp.


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

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1