Ipopt  3.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Ipopt::CompoundVector Class Reference

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

#include <IpCompoundVector.hpp>

+ Inheritance diagram for Ipopt::CompoundVector:

Public Member Functions

void SetComp (Index icomp, const Vector &vec)
 Method for setting the pointer for a component that is a const Vector. More...
 
void SetCompNonConst (Index icomp, Vector &vec)
 Method for setting the pointer for a component that is a non-const Vector. More...
 
Index NComps () const
 Number of components of this compound vector. More...
 
bool IsCompConst (Index i) const
 Check if a particular component is const or not. More...
 
bool IsCompNull (Index i) const
 Check if a particular component is null or not. More...
 
SmartPtr< const VectorGetComp (Index i) const
 Return a particular component (const version) More...
 
SmartPtr< VectorGetCompNonConst (Index i)
 Return a particular component (non-const version). More...
 
Constructors/Destructors
 CompoundVector (const CompoundVectorSpace *owner_space, bool create_new)
 Constructor, given the corresponding CompoundVectorSpace. More...
 
virtual ~CompoundVector ()
 Default destructor. More...
 
- Public Member Functions inherited from Ipopt::Vector
VectorMakeNew () const
 Create new Vector of the same type with uninitialized data. More...
 
VectorMakeNewCopy () const
 Create new Vector of the same type and copy the data over. More...
 
bool HasValidNumbers () const
 Method for determining if all stored numbers are valid (i.e., no Inf or Nan). More...
 
 Vector (const VectorSpace *owner_space)
 Constructor. More...
 
virtual ~Vector ()
 Destructor. More...
 
void Copy (const Vector &x)
 Copy the data of the vector x into this vector (DCOPY). More...
 
void Scal (Number alpha)
 Scales the vector by scalar alpha (DSCAL) More...
 
void Axpy (Number alpha, const Vector &x)
 Add the multiple alpha of vector x to this vector (DAXPY) More...
 
Number Dot (const Vector &x) const
 Computes inner product of vector x with this (DDOT) More...
 
Number Nrm2 () const
 Computes the 2-norm of this vector (DNRM2) More...
 
Number Asum () const
 Computes the 1-norm of this vector (DASUM) More...
 
Number Amax () const
 Computes the max-norm of this vector (based on IDAMAX) More...
 
void Set (Number alpha)
 Set each element in the vector to the scalar alpha. More...
 
void ElementWiseDivide (const Vector &x)
 Element-wise division $y_i \gets y_i/x_i$. More...
 
void ElementWiseMultiply (const Vector &x)
 Element-wise multiplication $y_i \gets y_i*x_i$. More...
 
void ElementWiseMax (const Vector &x)
 Element-wise max against entries in x. More...
 
void ElementWiseMin (const Vector &x)
 Element-wise min against entries in x. More...
 
void ElementWiseReciprocal ()
 Reciprocates the entries in the vector. More...
 
void ElementWiseAbs ()
 Absolute values of the entries in the vector. More...
 
void ElementWiseSqrt ()
 Element-wise square root of the entries in the vector. More...
 
void ElementWiseSgn ()
 
Replaces the vector values with their sgn values

( -1 if x_i < 0, 0 if x_i == 0, and 1 if x_i > 0) More...

 
void AddScalar (Number scalar)
 Add scalar to every vector component. More...
 
Number Max () const
 Returns the maximum value in the vector. More...
 
Number Min () const
 Returns the minimum value in the vector. More...
 
Number Sum () const
 Returns the sum of the vector entries. More...
 
Number SumLogs () const
 Returns the sum of the logs of each vector entry. More...
 
void AddOneVector (Number a, const Vector &v1, Number c)
 Add one vector, y = a * v1 + c * y. More...
 
void AddTwoVectors (Number a, const Vector &v1, Number b, const Vector &v2, Number c)
 Add two vectors, y = a * v1 + b * v2 + c * y. More...
 
Number FracToBound (const Vector &delta, Number tau) const
 Fraction to the boundary parameter. More...
 
void AddVectorQuotient (Number a, const Vector &z, const Vector &s, Number c)
 Add the quotient of two vectors, y = a * z/s + c * y. More...
 
Index Dim () const
 Dimension of the Vector. More...
 
SmartPtr< const VectorSpaceOwnerSpace () const
 Return the owner VectorSpace. More...
 
void Print (SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
 Print the entire vector. More...
 
void Print (const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
 
- Public Member Functions inherited from Ipopt::TaggedObject
 TaggedObject ()
 Constructor. More...
 
virtual ~TaggedObject ()
 Destructor. More...
 
Tag GetTag () const
 Users of TaggedObjects call this to update their own internal tags every time they perform the expensive operation. More...
 
bool HasChanged (const Tag comparison_tag) const
 Users of TaggedObjects call this to check if the object HasChanged since they last updated their own internal tag. More...
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 
- Public Member Functions inherited from Ipopt::Subject
 Subject ()
 Default Constructor. More...
 
virtual ~Subject ()
 Default destructor. More...
 
void AttachObserver (Observer::NotifyType notify_type, Observer *observer) const
 Attach the specified observer (i.e., begin recieving notifications). More...
 
void DetachObserver (Observer::NotifyType notify_type, Observer *observer) const
 Detach the specified observer (i.e., no longer recieve notifications). More...
 

Protected Member Functions

virtual bool HasValidNumbersImpl () const
 Method for determining if all stored numbers are valid (i.e., no Inf or Nan). More...
 
Overloaded methods from Vector base class
virtual void CopyImpl (const Vector &x)
 Copy the data of the vector x into this vector (DCOPY). More...
 
virtual void ScalImpl (Number alpha)
 Scales the vector by scalar alpha (DSCAL) More...
 
virtual void AxpyImpl (Number alpha, const Vector &x)
 Add the multiple alpha of vector x to this vector (DAXPY) More...
 
virtual Number DotImpl (const Vector &x) const
 Computes inner product of vector x with this (DDOT) More...
 
virtual Number Nrm2Impl () const
 Computes the 2-norm of this vector (DNRM2) More...
 
virtual Number AsumImpl () const
 Computes the 1-norm of this vector (DASUM) More...
 
virtual Number AmaxImpl () const
 Computes the max-norm of this vector (based on IDAMAX) More...
 
virtual void SetImpl (Number value)
 Set each element in the vector to the scalar alpha. More...
 
virtual void ElementWiseDivideImpl (const Vector &x)
 Element-wise division $y_i \gets y_i/x_i$. More...
 
virtual void ElementWiseMultiplyImpl (const Vector &x)
 Element-wise multiplication $y_i \gets y_i*x_i$. More...
 
virtual void ElementWiseMaxImpl (const Vector &x)
 Element-wise max against entries in x. More...
 
virtual void ElementWiseMinImpl (const Vector &x)
 Element-wise min against entries in x. More...
 
virtual void ElementWiseReciprocalImpl ()
 Element-wise reciprocal. More...
 
virtual void ElementWiseAbsImpl ()
 Element-wise absolute values. More...
 
virtual void ElementWiseSqrtImpl ()
 Element-wise square-root. More...
 
virtual void ElementWiseSgnImpl ()
 Replaces entries with sgn of the entry. More...
 
virtual void AddScalarImpl (Number scalar)
 Add scalar to every component of the vector. More...
 
virtual Number MaxImpl () const
 Max value in the vector. More...
 
virtual Number MinImpl () const
 Min value in the vector. More...
 
virtual Number SumImpl () const
 Computes the sum of the lements of vector. More...
 
virtual Number SumLogsImpl () const
 Computes the sum of the logs of the elements of vector. More...
 
Implemented specialized functions
void AddTwoVectorsImpl (Number a, const Vector &v1, Number b, const Vector &v2, Number c)
 Add two vectors (a * v1 + b * v2). More...
 
Number FracToBoundImpl (const Vector &delta, Number tau) const
 Fraction to the boundary parameter. More...
 
void AddVectorQuotientImpl (Number a, const Vector &z, const Vector &s, Number c)
 Add the quotient of two vectors, y = a * z/s + c * y. More...
 
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. More...
 
implementation methods (derived classes MUST

overload these pure virtual protected methods.)

- Protected Member Functions inherited from Ipopt::TaggedObject
void ObjectChanged ()
 Objects derived from TaggedObject MUST call this method every time their internal state changes to update the internal tag for comparison. More...
 
- Protected Member Functions inherited from Ipopt::Subject
void Notify (Observer::NotifyType notify_type) const
 

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. More...
 
 CompoundVector (const CompoundVector &)
 Copy Constructor. More...
 
void operator= (const CompoundVector &)
 Overloaded Equals Operator. More...
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from Ipopt::TaggedObject
typedef unsigned int Tag
 Type for the Tag values. More...
 

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

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

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ScalImpl ( Number  alpha)
protectedvirtual

Scales the vector by scalar alpha (DSCAL)

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::AxpyImpl ( Number  alpha,
const Vector x 
)
protectedvirtual

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

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::DotImpl ( const Vector x) const
protectedvirtual

Computes inner product of vector x with this (DDOT)

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::Nrm2Impl ( ) const
protectedvirtual

Computes the 2-norm of this vector (DNRM2)

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::AsumImpl ( ) const
protectedvirtual

Computes the 1-norm of this vector (DASUM)

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::AmaxImpl ( ) const
protectedvirtual

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

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::SetImpl ( Number  value)
protectedvirtual

Set each element in the vector to the scalar alpha.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseDivideImpl ( const Vector x)
protectedvirtual

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

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseMultiplyImpl ( const Vector x)
protectedvirtual

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

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseMaxImpl ( const Vector x)
protectedvirtual

Element-wise max against entries in x.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseMinImpl ( const Vector x)
protectedvirtual

Element-wise min against entries in x.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseReciprocalImpl ( )
protectedvirtual

Element-wise reciprocal.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseAbsImpl ( )
protectedvirtual

Element-wise absolute values.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseSqrtImpl ( )
protectedvirtual

Element-wise square-root.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::ElementWiseSgnImpl ( )
protectedvirtual

Replaces entries with sgn of the entry.

Implements Ipopt::Vector.

virtual void Ipopt::CompoundVector::AddScalarImpl ( Number  scalar)
protectedvirtual

Add scalar to every component of the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::MaxImpl ( ) const
protectedvirtual

Max value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::MinImpl ( ) const
protectedvirtual

Min value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::SumImpl ( ) const
protectedvirtual

Computes the sum of the lements of vector.

Implements Ipopt::Vector.

virtual Number Ipopt::CompoundVector::SumLogsImpl ( ) const
protectedvirtual

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

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
protectedvirtual

Fraction to the boundary parameter.

Reimplemented from Ipopt::Vector.

void Ipopt::CompoundVector::AddVectorQuotientImpl ( Number  a,
const Vector z,
const Vector s,
Number  c 
)
protectedvirtual

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

Reimplemented from Ipopt::Vector.

virtual bool Ipopt::CompoundVector::HasValidNumbersImpl ( ) const
protectedvirtual

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
protectedvirtual

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
inlineprivate

Definition at line 314 of file IpCompoundVector.hpp.

Vector * Ipopt::CompoundVector::Comp ( Index  i)
inlineprivate

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.

const CompoundVectorSpace* Ipopt::CompoundVector::owner_space_
private

Definition at line 222 of file IpCompoundVector.hpp.

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: