Class of Vectors consisting of other vectors. More...
#include <IpCompoundVector.hpp>
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. | |
Public Member Functions inherited from Ipopt::Vector | |
Vector * | MakeNew () const |
Create new Vector of the same type with uninitialized data. | |
Vector * | MakeNewCopy () const |
Create new Vector of the same type and copy the data over. | |
bool | HasValidNumbers () const |
Method for determining if all stored numbers are valid (i.e., no Inf or Nan). | |
Vector (const VectorSpace *owner_space) | |
Constructor. | |
virtual | ~Vector () |
Destructor. | |
void | Copy (const Vector &x) |
Copy the data of the vector x into this vector (DCOPY). | |
void | Scal (Number alpha) |
Scales the vector by scalar alpha (DSCAL) | |
void | Axpy (Number alpha, const Vector &x) |
Add the multiple alpha of vector x to this vector (DAXPY) | |
Number | Dot (const Vector &x) const |
Computes inner product of vector x with this (DDOT) | |
Number | Nrm2 () const |
Computes the 2-norm of this vector (DNRM2) | |
Number | Asum () const |
Computes the 1-norm of this vector (DASUM) | |
Number | Amax () const |
Computes the max-norm of this vector (based on IDAMAX) | |
void | Set (Number alpha) |
Set each element in the vector to the scalar alpha. | |
void | ElementWiseDivide (const Vector &x) |
Element-wise division \(y_i \gets y_i/x_i\). | |
void | ElementWiseMultiply (const Vector &x) |
Element-wise multiplication \(y_i \gets y_i*x_i\). | |
void | ElementWiseSelect (const Vector &x) |
Element-wise selection \(y_i \gets sgn(y_i)x_i, if y_i != 0, else 0\). | |
void | ElementWiseMax (const Vector &x) |
Element-wise max against entries in x. | |
void | ElementWiseMin (const Vector &x) |
Element-wise min against entries in x. | |
void | ElementWiseReciprocal () |
Reciprocates the entries in the vector. | |
void | ElementWiseAbs () |
Absolute values of the entries in the vector. | |
void | ElementWiseSqrt () |
Element-wise square root of the entries in the vector. | |
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) | |
void | AddScalar (Number scalar) |
Add scalar to every vector component. | |
Number | Max () const |
Returns the maximum value in the vector. | |
Number | Min () const |
Returns the minimum value in the vector. | |
Number | Sum () const |
Returns the sum of the vector entries. | |
Number | SumLogs () const |
Returns the sum of the logs of each vector entry. | |
void | AddOneVector (Number a, const Vector &v1, Number c) |
Add one vector, y = a * v1 + c * y. | |
void | AddTwoVectors (Number a, const Vector &v1, Number b, const Vector &v2, Number c) |
Add two vectors, y = a * v1 + b * v2 + c * y. | |
Number | FracToBound (const Vector &delta, Number tau) const |
Fraction to the boundary parameter. | |
void | AddVectorQuotient (Number a, const Vector &z, const Vector &s, Number c) |
Add the quotient of two vectors, y = a * z/s + c * y. | |
Index | Dim () const |
Dimension of the Vector. | |
SmartPtr< const VectorSpace > | OwnerSpace () const |
Return the owner VectorSpace. | |
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. | |
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. | |
virtual | ~TaggedObject () |
Destructor. | |
Tag | GetTag () const |
Users of TaggedObjects call this to update their own internal tags every time they perform the expensive operation. | |
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. | |
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. | |
virtual | ~Subject () |
Destructor. | |
void | AttachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Attach the specified observer (i.e., begin receiving notifications). | |
void | DetachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Detach the specified observer (i.e., no longer receive notifications). | |
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 | ElementWiseSelectImpl (const Vector &x) |
Element-wise selection \(y_i \gets sgn(y_i)x_i, if y_i != 0, else 0\). | |
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 () |
Reciprocates the elements of the vector. | |
virtual void | ElementWiseAbsImpl () |
Take elementwise absolute values of the elements of the vector. | |
virtual void | ElementWiseSqrtImpl () |
Take elementwise square-root of the elements of the vector. | |
virtual void | ElementWiseSgnImpl () |
Replaces entries with sgn of the entry. | |
virtual void | AddScalarImpl (Number scalar) |
Add scalar to every component of vector. | |
virtual Number | MaxImpl () const |
Max value in the vector. | |
virtual Number | MinImpl () const |
Min number in the vector. | |
virtual Number | SumImpl () const |
Sum of entries in the vector. | |
virtual Number | SumLogsImpl () const |
Sum of logs of entries in the 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 boundary parameter. | |
void | AddVectorQuotientImpl (Number a, const Vector &z, const Vector &s, Number c) |
Add the quotient of two vectors. | |
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. | |
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. | |
Protected Member Functions inherited from Ipopt::Subject | |
void | Notify (Observer::NotifyType notify_type) const |
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 &) |
Default Assignment Operator. | |
Private Attributes | |
std::vector< SmartPtr< Vector > > | comps_ |
Components of the compound vector. | |
std::vector< SmartPtr< const Vector > > | const_comps_ |
const CompoundVectorSpace * | owner_space_ |
bool | vectors_valid_ |
Additional Inherited Members | |
Public Types inherited from Ipopt::TaggedObject | |
typedef unsigned int | Tag |
Type for the Tag values. | |
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.
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.
|
inlinevirtual |
Default destructor.
Definition at line 52 of file IpCompoundVector.hpp.
|
private |
Default Constructor.
|
private |
Copy Constructor.
Method for setting the pointer for a component that is a const Vector.
Method for setting the pointer for a component that is a non-const Vector.
|
inline |
Number of components of this compound vector.
Definition at line 360 of file IpCompoundVector.hpp.
Check if a particular component is const or not.
Definition at line 71 of file IpCompoundVector.hpp.
Check if a particular component is null or not.
Definition at line 85 of file IpCompoundVector.hpp.
Return a particular component (const version)
Definition at line 98 of file IpCompoundVector.hpp.
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 111 of file IpCompoundVector.hpp.
Copy the data of the vector x into this vector (DCOPY).
Implements Ipopt::Vector.
Scales the vector by scalar alpha (DSCAL)
Implements Ipopt::Vector.
Add the multiple alpha of vector x to this vector (DAXPY)
Implements Ipopt::Vector.
Computes inner product of vector x with this (DDOT)
Implements Ipopt::Vector.
Computes the 2-norm of this vector (DNRM2)
Implements Ipopt::Vector.
Computes the 1-norm of this vector (DASUM)
Implements Ipopt::Vector.
Computes the max-norm of this vector (based on IDAMAX)
Implements Ipopt::Vector.
Set each element in the vector to the scalar alpha.
Implements Ipopt::Vector.
Element-wise division \(y_i \gets y_i/x_i\).
Implements Ipopt::Vector.
Element-wise multiplication \(y_i \gets y_i*x_i\).
Implements Ipopt::Vector.
Element-wise selection \(y_i \gets sgn(y_i)x_i, if y_i != 0, else 0\).
Implements Ipopt::Vector.
Element-wise max against entries in x.
Implements Ipopt::Vector.
Element-wise min against entries in x.
Implements Ipopt::Vector.
Reciprocates the elements of the vector.
Implements Ipopt::Vector.
Take elementwise absolute values of the elements of the vector.
Implements Ipopt::Vector.
Take elementwise square-root of the elements of the vector.
Implements Ipopt::Vector.
Replaces entries with sgn of the entry.
Implements Ipopt::Vector.
Add scalar to every component of vector.
Implements Ipopt::Vector.
Max value in the vector.
Implements Ipopt::Vector.
Min number in the vector.
Implements Ipopt::Vector.
Sum of entries in the vector.
Implements Ipopt::Vector.
Sum of logs of entries in the vector.
Implements Ipopt::Vector.
|
protectedvirtual |
Add two vectors (a * v1 + b * v2).
Result is stored in this vector.
Reimplemented from Ipopt::Vector.
|
protectedvirtual |
Fraction to boundary parameter.
Reimplemented from Ipopt::Vector.
|
protectedvirtual |
Add the quotient of two vectors.
Reimplemented from Ipopt::Vector.
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Reimplemented from Ipopt::Vector.
|
protectedvirtual |
Print the entire vector.
Implements Ipopt::Vector.
|
private |
Default Assignment Operator.
|
private |
Definition at line 365 of file IpCompoundVector.hpp.
Definition at line 384 of file IpCompoundVector.hpp.
Components of the compound vector.
The components are stored by SmartPtrs in a std::vector
Definition at line 256 of file IpCompoundVector.hpp.
Definition at line 257 of file IpCompoundVector.hpp.
|
private |
Definition at line 259 of file IpCompoundVector.hpp.
|
private |
Definition at line 261 of file IpCompoundVector.hpp.