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