Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpVector.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpVector.hpp 2472 2014-04-05 17:47:20Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPVECTOR_HPP__
10 #define __IPVECTOR_HPP__
11
12 #include "IpTypes.hpp"
13 #include "IpTaggedObject.hpp"
14 #include "IpCachedResults.hpp"
15 #include "IpSmartPtr.hpp"
16 #include "IpJournalist.hpp"
17 #include "IpException.hpp"
18
19 #include <vector>
20
21 namespace Ipopt
22 {
25 DECLARE_STD_EXCEPTION(UNIMPLEMENTED_LINALG_METHOD_CALLED);
26
27 /* forward declarations */
28 class VectorSpace;
29
47 class Vector : public TaggedObject
48 {
49 public:
55 inline
56 Vector(const VectorSpace* owner_space);
57
59 inline
60 virtual ~Vector();
62
64 inline
65 Vector* MakeNew() const;
66
68 inline
69 Vector* MakeNewCopy() const;
70
77 inline
78 void Copy(const Vector& x);
79
81 void Scal(Number alpha);
82
84 inline
85 void Axpy(Number alpha, const Vector &x);
86
88 inline
89 Number Dot(const Vector &x) const;
90
92 inline
93 Number Nrm2() const;
94
96 inline
97 Number Asum() const;
98
100 inline
101 Number Amax() const;
103
110 inline
111 void Set(Number alpha);
112
114 inline
115 void ElementWiseDivide(const Vector& x);
116
118 inline
119 void ElementWiseMultiply(const Vector& x);
120
122 inline
123 void ElementWiseMax(const Vector& x);
124
126 inline
127 void ElementWiseMin(const Vector& x);
128
130 inline
131 void ElementWiseReciprocal();
132
134 inline
135 void ElementWiseAbs();
136
138 inline
139 void ElementWiseSqrt();
140
144 inline
145 void ElementWiseSgn();
146
148 inline
149 void AddScalar(Number scalar);
150
152 inline
153 Number Max() const;
154
156 inline
157 Number Min() const;
158
160 inline
161 Number Sum() const;
162
164 inline
165 Number SumLogs() const;
167
175 inline
176 void AddOneVector(Number a, const Vector& v1, Number c);
177
180 inline void AddTwoVectors(Number a, const Vector& v1,
181 Number b, const Vector& v2, Number c);
185 inline
186 Number FracToBound(const Vector& delta, Number tau) const;
188 inline
189 void AddVectorQuotient(Number a, const Vector& z, const Vector& s,
190 Number c);
192
195 inline
196 bool HasValidNumbers() const;
197
201 inline
202 Index Dim() const;
203
205 inline
206 SmartPtr<const VectorSpace> OwnerSpace() const;
208
215 void Print(SmartPtr<const Journalist> jnlst,
216 EJournalLevel level,
217 EJournalCategory category,
218 const std::string& name,
219 Index indent=0,
220 const std::string& prefix="") const;
221 void Print(const Journalist& jnlst,
222 EJournalLevel level,
223 EJournalCategory category,
224 const std::string& name,
225 Index indent=0,
226 const std::string& prefix="") const;
228
229 protected:
235 virtual void CopyImpl(const Vector& x)=0;
236
238 virtual void ScalImpl(Number alpha)=0;
239
241 virtual void AxpyImpl(Number alpha, const Vector &x)=0;
242
244 virtual Number DotImpl(const Vector &x) const =0;
245
247 virtual Number Nrm2Impl() const =0;
248
250 virtual Number AsumImpl() const =0;
251
253 virtual Number AmaxImpl() const =0;
254
256 virtual void SetImpl(Number alpha)=0;
257
259 virtual void ElementWiseDivideImpl(const Vector& x)=0;
260
262 virtual void ElementWiseMultiplyImpl(const Vector& x)=0;
263
265 virtual void ElementWiseMaxImpl(const Vector& x)=0;
266
268 virtual void ElementWiseMinImpl(const Vector& x)=0;
269
271 virtual void ElementWiseReciprocalImpl()=0;
272
274 virtual void ElementWiseAbsImpl()=0;
275
277 virtual void ElementWiseSqrtImpl()=0;
278
280 virtual void ElementWiseSgnImpl()=0;
281
283 virtual void AddScalarImpl(Number scalar)=0;
284
286 virtual Number MaxImpl() const=0;
287
289 virtual Number MinImpl() const=0;
290
292 virtual Number SumImpl() const=0;
293
295 virtual Number SumLogsImpl() const=0;
296
299 virtual void AddTwoVectorsImpl(Number a, const Vector& v1,
300 Number b, const Vector& v2, Number c);
301
303 virtual Number FracToBoundImpl(const Vector& delta, Number tau) const;
304
306 virtual void AddVectorQuotientImpl(Number a, const Vector& z,
307 const Vector& s, Number c);
308
312 virtual bool HasValidNumbersImpl() const;
313
315 virtual void PrintImpl(const Journalist& jnlst,
316 EJournalLevel level,
317 EJournalCategory category,
318 const std::string& name,
319 Index indent,
320 const std::string& prefix) const =0;
322
323 private:
333 Vector();
334
336 Vector(const Vector&);
337
339 Vector& operator=(const Vector&);
341
343 const SmartPtr<const VectorSpace> owner_space_;
344
348 mutable CachedResults<Number> dot_cache_;
349
350 mutable TaggedObject::Tag nrm2_cache_tag_;
351 mutable Number cached_nrm2_;
352
353 mutable TaggedObject::Tag asum_cache_tag_;
354 mutable Number cached_asum_;
355
356 mutable TaggedObject::Tag amax_cache_tag_;
357 mutable Number cached_amax_;
358
359 mutable TaggedObject::Tag max_cache_tag_;
360 mutable Number cached_max_;
361
362 mutable TaggedObject::Tag min_cache_tag_;
363 mutable Number cached_min_;
364
365 mutable TaggedObject::Tag sum_cache_tag_;
366 mutable Number cached_sum_;
367
368 mutable TaggedObject::Tag sumlogs_cache_tag_;
369 mutable Number cached_sumlogs_;
370
371 mutable TaggedObject::Tag valid_cache_tag_;
372 mutable bool cached_valid_;
373
374 // AW: I removed this cache since it gets in the way for the
375 // quality function search
376 // /** Cache for FracToBound */
377 // mutable CachedResults<Number> frac_to_bound_cache_;
379
380 };
381
390 class VectorSpace : public ReferencedObject
391 {
392 public:
398 VectorSpace(Index dim);
399
401 virtual ~VectorSpace()
402 {}
404
408 virtual Vector* MakeNew() const=0;
409
411 Index Dim() const
412 {
413 return dim_;
414 }
415
416 private:
426 VectorSpace();
427
429 VectorSpace(const VectorSpace&);
430
432 VectorSpace& operator=(const VectorSpace&);
434
436 const Index dim_;
437 };
438
439 /* inline methods */
440 inline
441 Vector::~Vector()
442 {}
443
444 inline
445 Vector::Vector(const VectorSpace* owner_space)
446 :
447 TaggedObject(),
448 owner_space_(owner_space),
449 dot_cache_(10),
450 nrm2_cache_tag_(0),
451 asum_cache_tag_(0),
452 amax_cache_tag_(0),
453 max_cache_tag_(0),
454 min_cache_tag_(0),
455 sum_cache_tag_(0),
456 sumlogs_cache_tag_(0),
457 cached_valid_(0)
458 {
459 DBG_ASSERT(IsValid(owner_space_));
460 }
461
462 inline
463 Vector* Vector::MakeNew() const
464 {
465 return owner_space_->MakeNew();
466 }
467
468 inline
469 Vector* Vector::MakeNewCopy() const
470 {
471 // ToDo: We can probably copy also the cached values for Norms etc here
472 Vector* copy = MakeNew();
473 copy->Copy(*this);
474 return copy;
475 }
476
477 inline
478 void Vector::Copy(const Vector& x)
479 {
480 CopyImpl(x);
481 ObjectChanged();
482 // Also copy any cached scalar values from the original vector
483 // ToDo: Check if that is too much overhead
484 TaggedObject::Tag x_tag = x.GetTag();
485 if (x_tag == x.nrm2_cache_tag_) {
486 nrm2_cache_tag_ = GetTag();
487 cached_nrm2_ = x.cached_nrm2_;
488 }
489 if (x_tag == x.asum_cache_tag_) {
490 asum_cache_tag_ = GetTag();
491 cached_asum_ = x.cached_asum_;
492 }
493 if (x_tag == x.amax_cache_tag_) {
494 amax_cache_tag_ = GetTag();
495 cached_amax_ = x.cached_amax_;
496 }
497 if (x_tag == x.max_cache_tag_) {
498 max_cache_tag_ = GetTag();
499 cached_max_ = x.cached_max_;
500 }
501 if (x_tag == x.min_cache_tag_) {
502 min_cache_tag_ = GetTag();
503 cached_min_ = x.cached_min_;
504 }
505 if (x_tag == x.sum_cache_tag_) {
506 sum_cache_tag_ = GetTag();
507 cached_sum_ = x.cached_sum_;
508 }
509 if (x_tag == x.sumlogs_cache_tag_) {
510 sumlogs_cache_tag_ = GetTag();
511 cached_sumlogs_ = x.cached_sumlogs_;
512 }
513 }
514
515 inline
516 void Vector::Axpy(Number alpha, const Vector &x)
517 {
518 AxpyImpl(alpha, x);
519 ObjectChanged();
520 }
521
522 inline
523 Number Vector::Dot(const Vector &x) const
524 {
525 // The current implementation of the caching doesn't allow to have
526 // a dependency of something with itself. Therefore, we use the
527 // Nrm2 method if the dot product is to be taken with the vector
528 // itself. Might be more efficient anyway.
529 if (this==&x) {
530 Number nrm2 = Nrm2();
531 return nrm2*nrm2;
532 }
533 Number retValue;
534 if (!dot_cache_.GetCachedResult2Dep(retValue, this, &x)) {
535 retValue = DotImpl(x);
536 dot_cache_.AddCachedResult2Dep(retValue, this, &x);
537 }
538 return retValue;
539 }
540
541 inline
542 Number Vector::Nrm2() const
543 {
544 if (nrm2_cache_tag_ != GetTag()) {
545 cached_nrm2_ = Nrm2Impl();
546 nrm2_cache_tag_ = GetTag();
547 }
548 return cached_nrm2_;
549 }
550
551 inline
552 Number Vector::Asum() const
553 {
554 if (asum_cache_tag_ != GetTag()) {
555 cached_asum_ = AsumImpl();
556 asum_cache_tag_ = GetTag();
557 }
558 return cached_asum_;
559 }
560
561 inline
562 Number Vector::Amax() const
563 {
564 if (amax_cache_tag_ != GetTag()) {
565 cached_amax_ = AmaxImpl();
566 amax_cache_tag_ = GetTag();
567 }
568 return cached_amax_;
569 }
570
571 inline
572 Number Vector::Sum() const
573 {
574 if (sum_cache_tag_ != GetTag()) {
575 cached_sum_ = SumImpl();
576 sum_cache_tag_ = GetTag();
577 }
578 return cached_sum_;
579 }
580
581 inline
582 Number Vector::SumLogs() const
583 {
584 if (sumlogs_cache_tag_ != GetTag()) {
585 cached_sumlogs_ = SumLogsImpl();
586 sumlogs_cache_tag_ = GetTag();
587 }
588 return cached_sumlogs_;
589 }
590
591 inline
592 void Vector::ElementWiseSgn()
593 {
594 ElementWiseSgnImpl();
595 ObjectChanged();
596 }
597
598 inline
599 void Vector::Set(Number alpha)
600 {
601 // Could initialize caches here
602 SetImpl(alpha);
603 ObjectChanged();
604 }
605
606 inline
607 void Vector::ElementWiseDivide(const Vector& x)
608 {
609 ElementWiseDivideImpl(x);
610 ObjectChanged();
611 }
612
613 inline
614 void Vector::ElementWiseMultiply(const Vector& x)
615 {
616 ElementWiseMultiplyImpl(x);
617 ObjectChanged();
618 }
619
620 inline
621 void Vector::ElementWiseReciprocal()
622 {
623 ElementWiseReciprocalImpl();
624 ObjectChanged();
625 }
626
627 inline
628 void Vector::ElementWiseMax(const Vector& x)
629 {
630 // Could initialize some caches here
631 ElementWiseMaxImpl(x);
632 ObjectChanged();
633 }
634
635 inline
636 void Vector::ElementWiseMin(const Vector& x)
637 {
638 // Could initialize some caches here
639 ElementWiseMinImpl(x);
640 ObjectChanged();
641 }
642
643 inline
644 void Vector::ElementWiseAbs()
645 {
646 // Could initialize some caches here
647 ElementWiseAbsImpl();
648 ObjectChanged();
649 }
650
651 inline
652 void Vector::ElementWiseSqrt()
653 {
654 ElementWiseSqrtImpl();
655 ObjectChanged();
656 }
657
658 inline
659 void Vector::AddScalar(Number scalar)
660 {
661 // Could initialize some caches here
662 AddScalarImpl(scalar);
663 ObjectChanged();
664 }
665
666 inline
667 Number Vector::Max() const
668 {
669 if (max_cache_tag_ != GetTag()) {
670 cached_max_ = MaxImpl();
671 max_cache_tag_ = GetTag();
672 }
673 return cached_max_;
674 }
675
676 inline
677 Number Vector::Min() const
678 {
679 if (min_cache_tag_ != GetTag()) {
680 cached_min_ = MinImpl();
681 min_cache_tag_ = GetTag();
682 }
683 return cached_min_;
684 }
685
686 inline
687 void Vector::AddOneVector(Number a, const Vector& v1, Number c)
688 {
689 AddTwoVectors(a, v1, 0., v1, c);
690 }
691
692 inline
693 void Vector::AddTwoVectors(Number a, const Vector& v1,
694 Number b, const Vector& v2, Number c)
695 {
696 AddTwoVectorsImpl(a, v1, b, v2, c);
697 ObjectChanged();
698 }
699
700 inline
701 Number Vector::FracToBound(const Vector& delta, Number tau) const
702 {
703 /* AW: I avoid the caching here, since it leads to overhead in the
704 quality function search. Caches for this are in
705 CalculatedQuantities.
706 Number retValue;
707 std::vector<const TaggedObject*> tdeps(1);
708 tdeps[0] = &delta;
709 std::vector<Number> sdeps(1);
710 sdeps[0] = tau;
711 if (!frac_to_bound_cache_.GetCachedResult(retValue, tdeps, sdeps)) {
712 retValue = FracToBoundImpl(delta, tau);
713 frac_to_bound_cache_.AddCachedResult(retValue, tdeps, sdeps);
714 }
715 return retValue;
716 */
717 return FracToBoundImpl(delta, tau);
718 }
719
720 inline
721 void Vector::AddVectorQuotient(Number a, const Vector& z,
722 const Vector& s, Number c)
723 {
724 AddVectorQuotientImpl(a, z, s, c);
725 ObjectChanged();
726 }
727
728 inline
729 bool Vector::HasValidNumbers() const
730 {
731 if (valid_cache_tag_ != GetTag()) {
732 cached_valid_ = HasValidNumbersImpl();
733 valid_cache_tag_ = GetTag();
734 }
735 return cached_valid_;
736 }
737
738 inline
739 Index Vector::Dim() const
740 {
741 return owner_space_->Dim();
742 }
743
744 inline
745 SmartPtr<const VectorSpace> Vector::OwnerSpace() const
746 {
747 return owner_space_;
748 }
749
750 inline
751 VectorSpace::VectorSpace(Index dim)
752 :
753 dim_(dim)
754 {}
755
756 } // namespace Ipopt
757
758 // Macro definitions for debugging vectors
759 #if COIN_IPOPT_VERBOSITY == 0
760 # define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec)
761 #else
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(), \
766 J_ERROR, J_DBG, \
767 __vec_name, \
768 dbg_jrnl.IndentationLevel()*2, \
769 "# "); \
770 } \
771 }
772 #endif //if COIN_IPOPT_VERBOSITY == 0
773
774 #endif
Ipopt::Vector::valid_cache_tag_
TaggedObject::Tag valid_cache_tag_
Definition: IpVector.hpp:371
Ipopt::Vector::CopyImpl
virtual void CopyImpl(const Vector &x)=0
Copy the data of the vector x into this vector (DCOPY).
Ipopt::Vector::ElementWiseMinImpl
virtual void ElementWiseMinImpl(const Vector &x)=0
Element-wise min against entries in x.
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
Ipopt::VectorSpace::MakeNew
virtual Vector * MakeNew() const =0
Pure virtual method for creating a new Vector of the corresponding type.
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::Vector::SumLogs
Number SumLogs() const
Returns the sum of the logs of each vector entry.
Definition: IpVector.hpp:582
Ipopt::Vector::OwnerSpace
SmartPtr< const VectorSpace > OwnerSpace() const
Return the owner VectorSpace.
Definition: IpVector.hpp:745
Ipopt::Vector::max_cache_tag_
TaggedObject::Tag max_cache_tag_
Definition: IpVector.hpp:359
Ipopt::Vector::owner_space_
const SmartPtr< const VectorSpace > owner_space_
Vector Space.
Definition: IpVector.hpp:343
Ipopt::Vector::ElementWiseMaxImpl
virtual void ElementWiseMaxImpl(const Vector &x)=0
Element-wise max against entries in x.
Ipopt::Vector::FracToBound
Number FracToBound(const Vector &delta, Number tau) const
Fraction to the boundary parameter.
Definition: IpVector.hpp:701
Ipopt::Vector::ElementWiseAbs
void ElementWiseAbs()
Absolute values of the entries in the vector.
Definition: IpVector.hpp:644
Ipopt::Vector::MakeNewCopy
Vector * MakeNewCopy() const
Create new Vector of the same type and copy the data over.
Definition: IpVector.hpp:469
Ipopt::Vector::Vector
Vector()
Default constructor.
Ipopt::Vector::cached_sumlogs_
Number cached_sumlogs_
Definition: IpVector.hpp:369
Ipopt::Vector::Max
Number Max() const
Returns the maximum value in the vector.
Definition: IpVector.hpp:667
Ipopt::CachedResults::GetCachedResult2Dep
bool GetCachedResult2Dep(T &retResult, const TaggedObject *dependent1, const TaggedObject *dependent2)
Method for retrieving a cached result, proving two dependencies as a TaggedObject explicitly...
Definition: IpCachedResults.hpp:636
Ipopt::Vector::sumlogs_cache_tag_
TaggedObject::Tag sumlogs_cache_tag_
Definition: IpVector.hpp:368
Ipopt::Vector::MaxImpl
virtual Number MaxImpl() const =0
Max value in the vector.
Ipopt::Vector::AddVectorQuotientImpl
virtual void AddVectorQuotientImpl(Number a, const Vector &z, const Vector &s, Number c)
Add the quotient of two vectors.
Ipopt::Vector::AsumImpl
virtual Number AsumImpl() const =0
Computes the 1-norm of this vector (DASUM)
Ipopt::Vector::Amax
Number Amax() const
Computes the max-norm of this vector (based on IDAMAX)
Definition: IpVector.hpp:562
Ipopt::Vector::Nrm2
Number Nrm2() const
Computes the 2-norm of this vector (DNRM2)
Definition: IpVector.hpp:542
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::TaggedObject::ObjectChanged
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
Definition: IpTaggedObject.hpp:117
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
IpCachedResults.hpp
Ipopt::Vector::ElementWiseMin
void ElementWiseMin(const Vector &x)
Element-wise min against entries in x.
Definition: IpVector.hpp:636
Ipopt::Vector::ElementWiseSqrtImpl
virtual void ElementWiseSqrtImpl()=0
Take elementwise square-root of the elements of the vector.
Ipopt::Vector::AddScalarImpl
virtual void AddScalarImpl(Number scalar)=0
Add scalar to every component of vector.
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::Vector::ElementWiseDivide
void ElementWiseDivide(const Vector &x)
Element-wise division .
Definition: IpVector.hpp:607
Ipopt::CachedResults::AddCachedResult2Dep
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...
Definition: IpCachedResults.hpp:620
Ipopt::Vector::Asum
Number Asum() const
Computes the 1-norm of this vector (DASUM)
Definition: IpVector.hpp:552
Ipopt::Vector::ElementWiseSgnImpl
virtual void ElementWiseSgnImpl()=0
Replaces entries with sgn of the entry.
Ipopt::VectorSpace::Dim
Index Dim() const
Accessor function for the dimension of the vectors of this type.
Definition: IpVector.hpp:411
Ipopt::TaggedObject
TaggedObject class.
Definition: IpTaggedObject.hpp:76
Ipopt::Vector::Axpy
void Axpy(Number alpha, const Vector &x)
Add the multiple alpha of vector x to this vector (DAXPY)
Definition: IpVector.hpp:516
Ipopt::Vector::MakeNew
Vector * MakeNew() const
Create new Vector of the same type with uninitialized data.
Definition: IpVector.hpp:463
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::Vector::ElementWiseReciprocalImpl
virtual void ElementWiseReciprocalImpl()=0
Reciprocates the elements of the vector.
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::Vector::ElementWiseMax
void ElementWiseMax(const Vector &x)
Element-wise max against entries in x.
Definition: IpVector.hpp:628
Ipopt::Vector::AddScalar
void AddScalar(Number scalar)
Add scalar to every vector component.
Definition: IpVector.hpp:659
Ipopt::VectorSpace
VectorSpace base class, corresponding to the Vector base class.
Definition: IpVector.hpp:390
Ipopt::Vector::sum_cache_tag_
TaggedObject::Tag sum_cache_tag_
Definition: IpVector.hpp:365
Ipopt::Vector::Dot
Number Dot(const Vector &x) const
Computes inner product of vector x with this (DDOT)
Definition: IpVector.hpp:523
Ipopt::Vector::~Vector
virtual ~Vector()
Destructor.
Definition: IpVector.hpp:441
Ipopt::Vector::SumImpl
virtual Number SumImpl() const =0
Sum of entries in the vector.
Ipopt::Vector::Set
void Set(Number alpha)
Set each element in the vector to the scalar alpha.
Definition: IpVector.hpp:599
Ipopt::CachedResults< Number >
Ipopt::VectorSpace::operator=
VectorSpace & operator=(const VectorSpace &)
Overloaded Equals Operator.
Ipopt::Vector::AddVectorQuotient
void AddVectorQuotient(Number a, const Vector &z, const Vector &s, Number c)
Add the quotient of two vectors, y = a * z/s + c * y.
Definition: IpVector.hpp:721
Ipopt::Vector::Copy
void Copy(const Vector &x)
Copy the data of the vector x into this vector (DCOPY).
Definition: IpVector.hpp:478
Ipopt::Vector::cached_asum_
Number cached_asum_
Definition: IpVector.hpp:354
Ipopt::Vector::ElementWiseMultiplyImpl
virtual void ElementWiseMultiplyImpl(const Vector &x)=0
Element-wise multiplication .
Ipopt::Vector::Scal
void Scal(Number alpha)
Scales the vector by scalar alpha (DSCAL)
Ipopt::Vector::operator=
Vector & operator=(const Vector &)
Overloaded Equals Operator.
Ipopt::VectorSpace::VectorSpace
VectorSpace()
default constructor
Ipopt::Vector::cached_min_
Number cached_min_
Definition: IpVector.hpp:363
Ipopt::Vector::cached_max_
Number cached_max_
Definition: IpVector.hpp:360
Ipopt::Vector::ElementWiseAbsImpl
virtual void ElementWiseAbsImpl()=0
Take elementwise absolute values of the elements of the vector.
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::Vector::AmaxImpl
virtual Number AmaxImpl() const =0
Computes the max-norm of this vector (based on IDAMAX)
Ipopt::Vector::AddTwoVectors
void AddTwoVectors(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors, y = a * v1 + b * v2 + c * y.
Definition: IpVector.hpp:693
Ipopt::Vector::cached_sum_
Number cached_sum_
Definition: IpVector.hpp:366
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
IpTaggedObject.hpp
Ipopt::Vector::amax_cache_tag_
TaggedObject::Tag amax_cache_tag_
Definition: IpVector.hpp:356
Ipopt::Vector::Nrm2Impl
virtual Number Nrm2Impl() const =0
Computes the 2-norm of this vector (DNRM2)
Ipopt::TaggedObject::Tag
unsigned int Tag
Type for the Tag values.
Definition: IpTaggedObject.hpp:80
Ipopt::Vector::SetImpl
virtual void SetImpl(Number alpha)=0
Set each element in the vector to the scalar alpha.
Ipopt::Vector::nrm2_cache_tag_
TaggedObject::Tag nrm2_cache_tag_
Definition: IpVector.hpp:350
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
IpJournalist.hpp
Ipopt::Vector::min_cache_tag_
TaggedObject::Tag min_cache_tag_
Definition: IpVector.hpp:362
Ipopt::Vector::Min
Number Min() const
Returns the minimum value in the vector.
Definition: IpVector.hpp:677
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::Vector::AddTwoVectorsImpl
virtual void AddTwoVectorsImpl(Number a, const Vector &v1, Number b, const Vector &v2, Number c)
Add two vectors (a * v1 + b * v2).
Ipopt::Vector::Print
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.
Ipopt::VectorSpace::~VectorSpace
virtual ~VectorSpace()
Destructor.
Definition: IpVector.hpp:401
Ipopt::Vector::SumLogsImpl
virtual Number SumLogsImpl() const =0
Sum of logs of entries in the vector.
Ipopt::Vector::FracToBoundImpl
virtual Number FracToBoundImpl(const Vector &delta, Number tau) const
Fraction to boundary parameter.
Ipopt::Vector::ScalImpl
virtual void ScalImpl(Number alpha)=0
Scales the vector by scalar alpha (DSCAL)
Ipopt::Vector::AxpyImpl
virtual void AxpyImpl(Number alpha, const Vector &x)=0
Add the multiple alpha of vector x to this vector (DAXPY)
Ipopt::Vector::asum_cache_tag_
TaggedObject::Tag asum_cache_tag_
Definition: IpVector.hpp:353
Ipopt::Vector::Dim
Index Dim() const
Dimension of the Vector.
Definition: IpVector.hpp:739
Ipopt::Vector::ElementWiseMultiply
void ElementWiseMultiply(const Vector &x)
Element-wise multiplication .
Definition: IpVector.hpp:614
Ipopt::Vector::cached_nrm2_
Number cached_nrm2_
Definition: IpVector.hpp:351
Ipopt::VectorSpace::dim_
const Index dim_
Dimension of the vectors in this vector space.
Definition: IpVector.hpp:436
Ipopt::Vector::HasValidNumbers
bool HasValidNumbers() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Definition: IpVector.hpp:729
IpTypes.hpp
Ipopt::TaggedObject::GetTag
Tag GetTag() const
Users of TaggedObjects call this to update their own internal tags every time they perform the expens...
Definition: IpTaggedObject.hpp:98
Ipopt::Vector::AddOneVector
void AddOneVector(Number a, const Vector &v1, Number c)
Add one vector, y = a * v1 + c * y.
Definition: IpVector.hpp:687
Ipopt::Vector::cached_amax_
Number cached_amax_
Definition: IpVector.hpp:357
Ipopt::Vector::ElementWiseSqrt
void ElementWiseSqrt()
Element-wise square root of the entries in the vector.
Definition: IpVector.hpp:652
Ipopt::Vector::ElementWiseSgn
void ElementWiseSgn()
Replaces the vector values with their sgn values ( -1 if x_i &lt; 0, 0 if x_i == 0, and 1 if x_i &gt; 0) ...
Definition: IpVector.hpp:592
IpException.hpp
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::Vector::ElementWiseDivideImpl
virtual void ElementWiseDivideImpl(const Vector &x)=0
Element-wise division .
Ipopt::Vector::DotImpl
virtual Number DotImpl(const Vector &x) const =0
Computes inner product of vector x with this (DDOT)
Ipopt::Vector::dot_cache_
CachedResults< Number > dot_cache_
Cache for dot products.
Definition: IpVector.hpp:348
IpSmartPtr.hpp
Ipopt::Vector::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::Vector::Sum
Number Sum() const
Returns the sum of the vector entries.
Definition: IpVector.hpp:572
Ipopt::Vector::ElementWiseReciprocal
void ElementWiseReciprocal()
Reciprocates the entries in the vector.
Definition: IpVector.hpp:621
Ipopt::Vector::PrintImpl
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.
Ipopt::Vector::cached_valid_
bool cached_valid_
Definition: IpVector.hpp:372
Ipopt::Vector::MinImpl
virtual Number MinImpl() const =0
Min number in the vector.