7#ifndef __IPVECTOR_HPP__
8#define __IPVECTOR_HPP__
248 const std::string& name,
250 const std::string& prefix =
""
257 const std::string& name,
259 const std::string& prefix =
""
393 const std::string& name,
395 const std::string& prefix
632 if( !
dot_cache_.GetCachedResult2Dep(retValue,
this, &x) )
635 dot_cache_.AddCachedResult2Dep(retValue,
this, &x);
877#if IPOPT_VERBOSITY == 0
878# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec)
880# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) \
881 if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \
882 if (dbg_jrnl.Jnlst()!=NULL) { \
883 (__vec).Print(dbg_jrnl.Jnlst(), \
886 dbg_jrnl.IndentationLevel()*2, \
#define DECLARE_STD_EXCEPTION(__except_type)
Class responsible for all message output.
Template class for Smart Pointers.
Tag GetTag() const
Users of TaggedObjects call this to update their own internal tags every time they perform the expens...
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
unsigned int Tag
Type for the Tag values.
TaggedObject()
Constructor.
VectorSpace base class, corresponding to the Vector base class.
VectorSpace(const VectorSpace &)
Copy constructor.
Index Dim() const
Accessor function for the dimension of the vectors of this type.
VectorSpace & operator=(const VectorSpace &)
Default Assignment Operator.
VectorSpace()
Default constructor.
virtual Vector * MakeNew() const =0
Pure virtual method for creating a new Vector of the corresponding type.
VectorSpace(Index dim)
Constructor, given the dimension of all vectors generated by this VectorSpace.
const Index dim_
Dimension of the vectors in this vector space.
virtual ~VectorSpace()
Destructor.
virtual void AddTwoVectorsImpl(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors (a * v1 + b * v2).
virtual Number AmaxImpl() const =0
Computes the max-norm of this vector (based on IDAMAX)
SmartPtr< const VectorSpace > OwnerSpace() const
Return the owner VectorSpace.
Number Max() const
Returns the maximum value in the vector.
virtual void AddScalarImpl(Number scalar)=0
Add scalar to every component of vector.
virtual void ElementWiseReciprocalImpl()=0
Reciprocates the elements of the vector.
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 AddTwoVectors(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors, y = a * v1 + b * v2 + c * y.
virtual Number SumImpl() const =0
Sum of entries in the vector.
void ElementWiseMax(const Vector &x)
Element-wise max against entries in x.
virtual void ElementWiseSgnImpl()=0
Replaces entries with sgn of the entry.
Number Min() const
Returns the minimum value in the vector.
TaggedObject::Tag sum_cache_tag_
Vector()
Default constructor.
TaggedObject::Tag asum_cache_tag_
void ElementWiseMin(const Vector &x)
Element-wise min against entries in x.
virtual void ElementWiseMinImpl(const Vector &x)=0
Element-wise min against entries in x.
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)
Vector(const Vector &)
Copy constructor.
TaggedObject::Tag nrm2_cache_tag_
CachedResults< Number > dot_cache_
Cache for dot products.
TaggedObject::Tag sumlogs_cache_tag_
virtual Number MaxImpl() const =0
Max value in the vector.
void ElementWiseMultiply(const Vector &x)
Element-wise multiplication .
void Axpy(Number alpha, const Vector &x)
Add the multiple alpha of vector x to this vector (DAXPY)
const SmartPtr< const VectorSpace > owner_space_
Vector Space.
bool HasValidNumbers() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Vector * MakeNewCopy() const
Create new Vector of the same type and copy the data over.
virtual void CopyImpl(const Vector &x)=0
Copy the data of the vector x into this vector (DCOPY).
virtual void AxpyImpl(Number alpha, const Vector &x)=0
Add the multiple alpha of vector x to this vector (DAXPY)
Number Nrm2() const
Computes the 2-norm of this vector (DNRM2)
virtual Number SumLogsImpl() const =0
Sum of logs of entries in the vector.
virtual void SetImpl(Number alpha)=0
Set each element in the vector to the scalar alpha.
void AddScalar(Number scalar)
Add scalar to every vector component.
void AddVectorQuotient(Number a, const Vector &z, const Vector &s, Number c)
Add the quotient of two vectors, y = a * z/s + c * y.
void Scal(Number alpha)
Scales the vector by scalar alpha (DSCAL)
virtual void AddVectorQuotientImpl(Number a, const Vector &z, const Vector &s, Number c)
Add the quotient of two vectors.
Vector * MakeNew() const
Create new Vector of the same type with uninitialized data.
virtual Number AsumImpl() const =0
Computes the 1-norm of this vector (DASUM)
Number SumLogs() const
Returns the sum of the logs of each vector entry.
void ElementWiseDivide(const Vector &x)
Element-wise division .
virtual void ScalImpl(Number alpha)=0
Scales the vector by scalar alpha (DSCAL)
TaggedObject::Tag amax_cache_tag_
void Copy(const Vector &x)
Copy the data of the vector x into this vector (DCOPY).
Index Dim() const
Dimension of the Vector.
void Set(Number alpha)
Set each element in the vector to the scalar alpha.
virtual void ElementWiseSelectImpl(const Vector &x)=0
Element-wise selection .
virtual void ElementWiseMultiplyImpl(const Vector &x)=0
Element-wise multiplication .
Number Amax() const
Computes the max-norm of this vector (based on IDAMAX)
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
Number Sum() const
Returns the sum of the vector entries.
void AddOneVector(Number a, const Vector &v1, Number c)
Add one vector, y = a * v1 + c * y.
virtual void ElementWiseDivideImpl(const Vector &x)=0
Element-wise division .
virtual Number DotImpl(const Vector &x) const =0
Computes inner product of vector x with this (DDOT)
void ElementWiseSqrt()
Element-wise square root of the entries in the vector.
Number Asum() const
Computes the 1-norm of this vector (DASUM)
Vector(const VectorSpace *owner_space)
Constructor.
virtual Number MinImpl() const =0
Min number in the vector.
virtual Number Nrm2Impl() const =0
Computes the 2-norm of this vector (DNRM2)
Vector & operator=(const Vector &)
Default Assignment Operator.
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
Print the entire vector.
TaggedObject::Tag max_cache_tag_
Number FracToBound(const Vector &delta, Number tau) const
Fraction to the boundary parameter.
void ElementWiseReciprocal()
Reciprocates the entries in the vector.
void ElementWiseSelect(const Vector &x)
Element-wise selection .
void ElementWiseAbs()
Absolute values of the entries in the vector.
virtual void ElementWiseAbsImpl()=0
Take elementwise absolute values of the elements of the vector.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
virtual ~Vector()
Destructor.
virtual void ElementWiseMaxImpl(const Vector &x)=0
Element-wise max against entries in x.
virtual Number FracToBoundImpl(const Vector &delta, Number tau) const
Fraction to boundary parameter.
TaggedObject::Tag valid_cache_tag_
virtual void ElementWiseSqrtImpl()=0
Take elementwise square-root of the elements of the vector.
TaggedObject::Tag min_cache_tag_
Number Dot(const Vector &x) const
Computes inner product of vector x with this (DDOT)
This file contains a base class for all exceptions and a set of macros to help with exceptions.
bool IsValid(const SmartPtr< U > &smart_ptr)
ipindex Index
Type of all indices of vectors, matrices etc.
EJournalCategory
Category Selection Enum.
EJournalLevel
Print Level Enum.
ipnumber Number
Type of all numbers.