9 #ifndef __IPVECTOR_HPP__
10 #define __IPVECTOR_HPP__
218 const std::string& name,
220 const std::string& prefix=
"")
const;
224 const std::string& name,
226 const std::string& prefix=
"")
const;
318 const std::string& name,
320 const std::string& prefix)
const =0;
448 owner_space_(owner_space),
456 sumlogs_cache_tag_(0),
759 #if COIN_IPOPT_VERBOSITY == 0
760 # define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec)
762 # define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) \
763 if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \
764 if (dbg_jrnl.Jnlst()!=NULL) { \
765 (__vec).Print(dbg_jrnl.Jnlst(), \
768 dbg_jrnl.IndentationLevel()*2, \
772 #endif //if COIN_IPOPT_VERBOSITY == 0
TaggedObject::Tag valid_cache_tag_
virtual void CopyImpl(const Vector &x)=0
Copy the data of the vector x into this vector (DCOPY).
virtual void ElementWiseMinImpl(const Vector &x)=0
Element-wise min against entries in x.
bool IsValid(const SmartPtr< U > &smart_ptr)
virtual Vector * MakeNew() const =0
Pure virtual method for creating a new Vector of the corresponding type.
Number * x
Input: Starting point Output: Optimal solution.
Number SumLogs() const
Returns the sum of the logs of each vector entry.
SmartPtr< const VectorSpace > OwnerSpace() const
Return the owner VectorSpace.
TaggedObject::Tag max_cache_tag_
const SmartPtr< const VectorSpace > owner_space_
Vector Space.
virtual void ElementWiseMaxImpl(const Vector &x)=0
Element-wise max against entries in x.
Number FracToBound(const Vector &delta, Number tau) const
Fraction to the boundary parameter.
void ElementWiseAbs()
Absolute values of the entries in the vector.
Vector * MakeNewCopy() const
Create new Vector of the same type and copy the data over.
Vector()
Default constructor.
Number Max() const
Returns the maximum value in the vector.
bool GetCachedResult2Dep(T &retResult, const TaggedObject *dependent1, const TaggedObject *dependent2)
Method for retrieving a cached result, proving two dependencies as a TaggedObject explicitly...
TaggedObject::Tag sumlogs_cache_tag_
virtual Number MaxImpl() const =0
Max value in the vector.
virtual void AddVectorQuotientImpl(Number a, const Vector &z, const Vector &s, Number c)
Add the quotient of two vectors.
virtual Number AsumImpl() const =0
Computes the 1-norm of this vector (DASUM)
Number Amax() const
Computes the max-norm of this vector (based on IDAMAX)
Number Nrm2() const
Computes the 2-norm of this vector (DNRM2)
double Number
Type of all numbers.
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
void ElementWiseMin(const Vector &x)
Element-wise min against entries in x.
virtual void ElementWiseSqrtImpl()=0
Take elementwise square-root of the elements of the vector.
virtual void AddScalarImpl(Number scalar)=0
Add scalar to every component of vector.
EJournalLevel
Print Level Enum.
void ElementWiseDivide(const Vector &x)
Element-wise division .
void AddCachedResult2Dep(const T &result, const TaggedObject *dependent1, const TaggedObject *dependent2)
Method for adding a result to the cache, proving two dependencies as a TaggedObject explicitly...
Number Asum() const
Computes the 1-norm of this vector (DASUM)
virtual void ElementWiseSgnImpl()=0
Replaces entries with sgn of the entry.
Index Dim() const
Accessor function for the dimension of the vectors of this type.
void Axpy(Number alpha, const Vector &x)
Add the multiple alpha of vector x to this vector (DAXPY)
Vector * MakeNew() const
Create new Vector of the same type with uninitialized data.
Template class for Smart Pointers.
virtual void ElementWiseReciprocalImpl()=0
Reciprocates the elements of the vector.
void ElementWiseMax(const Vector &x)
Element-wise max against entries in x.
void AddScalar(Number scalar)
Add scalar to every vector component.
VectorSpace base class, corresponding to the Vector base class.
TaggedObject::Tag sum_cache_tag_
Number Dot(const Vector &x) const
Computes inner product of vector x with this (DDOT)
virtual ~Vector()
Destructor.
virtual Number SumImpl() const =0
Sum of entries in the vector.
void Set(Number alpha)
Set each element in the vector to the scalar alpha.
VectorSpace & operator=(const VectorSpace &)
Overloaded Equals Operator.
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 Copy(const Vector &x)
Copy the data of the vector x into this vector (DCOPY).
virtual void ElementWiseMultiplyImpl(const Vector &x)=0
Element-wise multiplication .
void Scal(Number alpha)
Scales the vector by scalar alpha (DSCAL)
Vector & operator=(const Vector &)
Overloaded Equals Operator.
VectorSpace()
default constructor
virtual void ElementWiseAbsImpl()=0
Take elementwise absolute values of the elements of the vector.
int Index
Type of all indices of vectors, matrices etc.
virtual Number AmaxImpl() const =0
Computes the max-norm of this vector (based on IDAMAX)
void AddTwoVectors(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors, y = a * v1 + b * v2 + c * y.
TaggedObject::Tag amax_cache_tag_
virtual Number Nrm2Impl() const =0
Computes the 2-norm of this vector (DNRM2)
unsigned int Tag
Type for the Tag values.
virtual void SetImpl(Number alpha)=0
Set each element in the vector to the scalar alpha.
TaggedObject::Tag nrm2_cache_tag_
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
TaggedObject::Tag min_cache_tag_
Number Min() const
Returns the minimum value in the vector.
Class responsible for all message output.
virtual void AddTwoVectorsImpl(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors (a * v1 + b * v2).
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.
virtual ~VectorSpace()
Destructor.
virtual Number SumLogsImpl() const =0
Sum of logs of entries in the vector.
virtual Number FracToBoundImpl(const Vector &delta, Number tau) const
Fraction to boundary parameter.
virtual void ScalImpl(Number alpha)=0
Scales the vector by scalar alpha (DSCAL)
virtual void AxpyImpl(Number alpha, const Vector &x)=0
Add the multiple alpha of vector x to this vector (DAXPY)
TaggedObject::Tag asum_cache_tag_
Index Dim() const
Dimension of the Vector.
void ElementWiseMultiply(const Vector &x)
Element-wise multiplication .
const Index dim_
Dimension of the vectors in this vector space.
bool HasValidNumbers() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Tag GetTag() const
Users of TaggedObjects call this to update their own internal tags every time they perform the expens...
void AddOneVector(Number a, const Vector &v1, Number c)
Add one vector, y = a * v1 + c * y.
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) ...
EJournalCategory
Category Selection Enum.
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)
CachedResults< Number > dot_cache_
Cache for dot products.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Number Sum() const
Returns the sum of the vector entries.
void ElementWiseReciprocal()
Reciprocates the entries in the vector.
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.
virtual Number MinImpl() const =0
Min number in the vector.