- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Ipopt::CompoundVector Class Reference

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

`#include <IpCompoundVector.hpp>`

Inheritance diagram for Ipopt::CompoundVector:

[legend]
Collaboration diagram for Ipopt::CompoundVector:

[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 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.
## Private Member Functions
bool | VectorsValid ()
const Vector * | ConstComp (Index i) const
Vector * | Comp (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 CompoundVectorSpace * | owner_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: . 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.

Referenced by Ipopt::IteratesVector::Set_bound_mult(), Ipopt::IteratesVector::Set_eq_mult(), Ipopt::IteratesVector::Set_primal(), Ipopt::IteratesVector::Set_s(), Ipopt::IteratesVector::Set_v_L(), Ipopt::IteratesVector::Set_v_U(), Ipopt::IteratesVector::Set_x(), Ipopt::IteratesVector::Set_y_c(), Ipopt::IteratesVector::Set_y_d(), Ipopt::IteratesVector::Set_z_L(), and Ipopt::IteratesVector::Set_z_U().

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

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

Referenced by Ipopt::IteratesVector::Set_bound_mult_NonConst(), Ipopt::IteratesVector::Set_eq_mult_NonConst(), Ipopt::IteratesVector::Set_primal_NonConst(), Ipopt::IteratesVector::Set_s_NonConst(), Ipopt::IteratesVector::Set_v_L_NonConst(), Ipopt::IteratesVector::Set_v_U_NonConst(), Ipopt::IteratesVector::Set_x_NonConst(), Ipopt::IteratesVector::Set_y_c_NonConst(), Ipopt::IteratesVector::Set_y_d_NonConst(), Ipopt::IteratesVector::Set_z_L_NonConst(), and Ipopt::IteratesVector::Set_z_U_NonConst().

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

Number of components of this compound vector.

Definition at line 308 of file IpCompoundVector.hpp.

References Ipopt::CompoundVectorSpace::NCompSpaces(), and owner_space_.

Referenced by Comp(), ConstComp(), IsCompConst(), and IsCompNull().

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.

References comps_, const_comps_, DBG_ASSERT, Ipopt::IsValid(), and NComps().

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.

References comps_, const_comps_, DBG_ASSERT, Ipopt::IsValid(), and NComps().

Referenced by Ipopt::IteratesVector::GetIterateFromComp(), and Ipopt::IteratesVector::GetNonConstIterateFromComp().

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

Return a particular component (const version).

Definition at line 86 of file IpCompoundVector.hpp.

References ConstComp().

Referenced by Ipopt::IteratesVector::create_new_s_copy(), Ipopt::IteratesVector::create_new_v_L_copy(), Ipopt::IteratesVector::create_new_v_U_copy(), Ipopt::IteratesVector::create_new_x_copy(), Ipopt::IteratesVector::create_new_y_c_copy(), Ipopt::IteratesVector::create_new_y_d_copy(), Ipopt::IteratesVector::create_new_z_L_copy(), Ipopt::IteratesVector::create_new_z_U_copy(), and Ipopt::IteratesVector::GetIterateFromComp().

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.

References Comp(), and Ipopt::TaggedObject::ObjectChanged().

Referenced by Ipopt::IteratesVector::GetNonConstIterateFromComp().

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

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

Implements Ipopt::Vector.

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

Implements Ipopt::Vector.

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

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

Implements Ipopt::Vector.

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 .

Implements Ipopt::Vector.

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

Element-wise multiplication .

Implements Ipopt::Vector.

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

Element-wise max against entries in x.

Implements Ipopt::Vector.

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

Element-wise min against entries in x.

Implements Ipopt::Vector.

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, virtual]`

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

Result is stored in this vector.

Reimplemented from Ipopt::Vector.

Number Ipopt::CompoundVector::FracToBoundImpl | ( | const Vector & | delta,
|  | Number | tau |
| ) |  |  | const`[protected, virtual]`

Fraction to the boundary parameter.

Reimplemented from Ipopt::Vector.

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

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.

bool Ipopt::CompoundVector::VectorsValid | ( |  | ) | `[private]`

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

Definition at line 314 of file IpCompoundVector.hpp.

References comps_, const_comps_, DBG_ASSERT, Ipopt::GetRawPtr(), Ipopt::IsValid(), and NComps().

Referenced by GetComp().

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

Definition at line 330 of file IpCompoundVector.hpp.

References comps_, DBG_ASSERT, Ipopt::GetRawPtr(), Ipopt::IsValid(), and NComps().

Referenced by GetCompNonConst().

## 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.

Referenced by Comp(), ConstComp(), IsCompConst(), and IsCompNull().

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

Definition at line 220 of file IpCompoundVector.hpp.

Referenced by ConstComp(), IsCompConst(), and IsCompNull().

const CompoundVectorSpace* Ipopt::CompoundVector::owner_space_`[private]`

Vector Space.

Reimplemented from Ipopt::Vector.

Reimplemented in Ipopt::IteratesVector.

Definition at line 222 of file IpCompoundVector.hpp.

Referenced by NComps().

bool Ipopt::CompoundVector::vectors_valid_`[private]`

Definition at line 224 of file IpCompoundVector.hpp.

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

- /home/coin/SVN-release/Ipopt-3.7.1/Ipopt/src/LinAlg/IpCompoundVector.hpp