7 #ifndef __IPVECTOR_HPP__
8 #define __IPVECTOR_HPP__
65 inline Vector* MakeNew()
const;
68 inline Vector* MakeNewCopy()
const;
98 inline Number Nrm2()
const;
101 inline Number Asum()
const;
104 inline Number Amax()
const;
119 inline void ElementWiseDivide(
124 inline void ElementWiseMultiply(
129 inline void ElementWiseMax(
134 inline void ElementWiseMin(
139 inline void ElementWiseReciprocal();
142 inline void ElementWiseAbs();
145 inline void ElementWiseSqrt();
150 inline void ElementWiseSgn();
153 inline void AddScalar(
164 inline Number Sum()
const;
167 inline Number SumLogs()
const;
180 inline void AddOneVector(
190 inline void AddTwoVectors(
202 inline Number FracToBound(
208 inline void AddVectorQuotient(
217 inline bool HasValidNumbers()
const;
222 inline Index Dim()
const;
239 const std::string& name,
241 const std::string& prefix =
""
248 const std::string& name,
250 const std::string& prefix =
""
260 virtual void CopyImpl(
265 virtual void ScalImpl(
270 virtual void AxpyImpl(
281 virtual Number Nrm2Impl()
const = 0;
284 virtual Number AsumImpl()
const = 0;
287 virtual Number AmaxImpl()
const = 0;
290 virtual void SetImpl(
295 virtual void ElementWiseDivideImpl(
300 virtual void ElementWiseMultiplyImpl(
305 virtual void ElementWiseMaxImpl(
310 virtual void ElementWiseMinImpl(
315 virtual void ElementWiseReciprocalImpl() = 0;
318 virtual void ElementWiseAbsImpl() = 0;
321 virtual void ElementWiseSqrtImpl() = 0;
324 virtual void ElementWiseSgnImpl() = 0;
327 virtual void AddScalarImpl(
332 virtual Number MaxImpl()
const = 0;
335 virtual Number MinImpl()
const = 0;
338 virtual Number SumImpl()
const = 0;
341 virtual Number SumLogsImpl()
const = 0;
347 virtual void AddTwoVectorsImpl(
356 virtual Number FracToBoundImpl(
362 virtual void AddVectorQuotientImpl(
372 virtual bool HasValidNumbersImpl()
const;
375 virtual void PrintImpl(
379 const std::string& name,
381 const std::string& prefix
478 virtual Vector* MakeNew()
const = 0;
522 owner_space_(owner_space),
530 sumlogs_cache_tag_(0),
855 #if COIN_IPOPT_VERBOSITY == 0
856 # define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec)
858 # define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) \
859 if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \
860 if (dbg_jrnl.Jnlst()!=NULL) { \
861 (__vec).Print(dbg_jrnl.Jnlst(), \
864 dbg_jrnl.IndentationLevel()*2, \
868 #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)
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_
virtual void ElementWiseMaxImpl(const Vector &x)=0
Element-wise max against entries in x.
const SmartPtr< const VectorSpace > owner_space_
Vector Space.
Number FracToBound(const Vector &delta, Number tau) const
Fraction to the boundary parameter.
void ElementWiseAbs()
Absolute values of the entries in the vector.
Index Max(Index a, Index b)
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)
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
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.
Storing the reference count of all the smart pointers that currently reference it.
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.
Index Min(Index a, Index b)
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 .
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_
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).
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 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 Number MinImpl() const =0
Min number in the vector.