Dense vector with semi-sparse vector for updatesIn many algorithms vectors are updated in every iteration, by adding a multiple of another vector to it, i.e., given a vector x
, a scalar \(\alpha\) and another vector \(\delta\), the update to x
constists of substituting it by \(x \leftarrow x + \alpha\cdot\delta\).
More...
#include <updatevector.h>
Public Member Functions | |
Constructors / destructors | |
UpdateVector (int p_dim, Real p_eps) | |
default constructor. More... | |
~UpdateVector () | |
UpdateVector (const UpdateVector &) | |
copy constructor More... | |
UpdateVector & | operator= (const DVector &rhs) |
assignment from DVector More... | |
UpdateVector & | operator= (const Vector &rhs) |
assignment from Vector More... | |
UpdateVector & | operator= (const UpdateVector &rhs) |
assignment More... | |
Access | |
Real & | value () |
update multiplicator \(\alpha\), writeable More... | |
Real | value () const |
update multiplicator \(\alpha\) More... | |
SSVector & | delta () |
update vector \(\delta\), writeable More... | |
const SSVector & | delta () const |
update vector \(\delta\) More... | |
const IdxSet & | idx () const |
nonzero indices of update vector \(\delta\) More... | |
Modification | |
void | update () |
Perform the update. More... | |
void | clear () |
clear vector and update vector More... | |
void | clearUpdate () |
clear \(\delta\), \(\alpha\) More... | |
void | reDim (int newdim) |
reset dimension More... | |
Consistency check | |
bool | isConsistent () const |
Public Member Functions inherited from DVectorBase< Real > | |
void | reSize (int newsize) |
Resets DVectorBase's memory size to newsize (specialization for Real). More... | |
DVectorBase (int d=0) | |
Default constructor. d is the initial dimension. More... | |
DVectorBase (const VectorBase< S > &old) | |
Copy constructor. More... | |
DVectorBase (const DVectorBase< Real > &old) | |
Copy constructor. More... | |
DVectorBase (const DVectorBase< S > &old) | |
Copy constructor. More... | |
DVectorBase< Real > & | operator= (const VectorBase< Real > &vec) |
Assignment operator. More... | |
DVectorBase< Real > & | operator= (const VectorBase< S > &vec) |
Assignment operator. More... | |
DVectorBase< Real > & | operator= (const DVectorBase< Real > &vec) |
Assignment operator. More... | |
DVectorBase< Real > & | operator= (const DVectorBase< S > &vec) |
Assignment operator. More... | |
DVectorBase< Real > & | operator= (const SVectorBase< S > &vec) |
Assignment operator. More... | |
virtual | ~DVectorBase () |
Destructor. More... | |
int | memSize () const |
Returns DVectorBase's memory size. More... | |
void | reDim (int newdim, const bool setZero=true) |
Resets DVectorBase's dimension to newdim . More... | |
void | reSize (int newsize) |
Resets DVectorBase's memory size to newsize . More... | |
bool | isConsistent () const |
Consistency check. More... | |
Public Member Functions inherited from VectorBase< Real > | |
VectorBase< Real > & | operator= (const VectorBase< Real > &vec) |
Assignment operator (specialization for Real). More... | |
VectorBase< Real > & | operator= (const VectorBase< Rational > &vec) |
Assignment operator (specialization for Real). More... | |
void | clear () |
Set vector to 0 (specialization for Real). More... | |
Rational | operator* (const VectorBase< Rational > &vec) const |
Inner product. More... | |
VectorBase (int p_dimen, Real *p_val) | |
Constructor. More... | |
VectorBase< Real > & | operator= (const VectorBase< S > &vec) |
Assignment operator. More... | |
VectorBase< Real > & | operator= (const VectorBase< Real > &vec) |
Assignment operator. More... | |
VectorBase< Real > & | operator= (const SVectorBase< S > &vec) |
Assignment operator. More... | |
VectorBase< Real > & | operator= (const SSVectorBase< S > &vec) |
Assignment operator. More... | |
VectorBase< Real > & | scaleAssign (int scaleExp, const VectorBase< Real > &vec) |
scale and assign More... | |
VectorBase< Real > & | scaleAssign (const int *scaleExp, const VectorBase< Real > &vec, bool negateExp=false) |
scale and assign More... | |
VectorBase< Real > & | assign (const SVectorBase< S > &vec) |
Assign values of vec . More... | |
VectorBase< Real > & | assign (const SSVectorBase< S > &vec) |
Assign values of vec . More... | |
void | clear () |
Set vector to 0. More... | |
VectorBase< Real > & | operator+= (const VectorBase< S > &vec) |
Addition. More... | |
VectorBase< Real > & | operator+= (const SVectorBase< S > &vec) |
Addition. More... | |
VectorBase< Real > & | operator+= (const SSVectorBase< S > &vec) |
Addition. More... | |
VectorBase< Real > & | operator-= (const VectorBase< S > &vec) |
Subtraction. More... | |
VectorBase< Real > & | operator-= (const SVectorBase< S > &vec) |
Subtraction. More... | |
VectorBase< Real > & | operator-= (const SSVectorBase< S > &vec) |
Subtraction. More... | |
VectorBase< Real > & | operator*= (const S &x) |
Scaling. More... | |
VectorBase< Real > & | operator/= (const S &x) |
Division. More... | |
Real | operator* (const VectorBase< Real > &vec) const |
Inner product. More... | |
Real | operator* (const SVectorBase< Real > &vec) const |
Inner product. More... | |
Real | operator* (const SSVectorBase< Real > &vec) const |
Inner product. More... | |
Real | maxAbs () const |
Maximum absolute value, i.e., infinity norm. More... | |
Real | minAbs () const |
Minimum absolute value. More... | |
Real | length () const |
Floating point approximation of euclidian norm (without any approximation guarantee). More... | |
Real | length2 () const |
Squared norm. More... | |
VectorBase< Real > & | multAdd (const S &x, const VectorBase< T > &vec) |
Addition of scaled vector. More... | |
VectorBase< Real > & | multAdd (const S &x, const SVectorBase< T > &vec) |
Addition of scaled vector. More... | |
VectorBase< Real > & | multAdd (const S &x, const SSVectorBase< T > &vec) |
Addition of scaled vector. More... | |
VectorBase< Real > & | multSub (const S &x, const SVectorBase< T > &vec) |
Subtraction of scaled vector. More... | |
Real * | get_ptr () |
Conversion to C-style pointer. More... | |
const Real * | get_const_ptr () const |
Conversion to C-style pointer. More... | |
bool | isConsistent () const |
Consistency check. More... | |
int | dim () const |
Dimension of vector. More... | |
Real & | operator[] (int n) |
Return n 'th value by reference. More... | |
const Real & | operator[] (int n) const |
Return n 'th value. More... | |
Private Attributes | |
Data | |
Real | theval |
update multiplicator More... | |
SSVector | thedelta |
update vector More... | |
Additional Inherited Members | |
Protected Attributes inherited from VectorBase< Real > | |
int | dimen |
Dimension of vector. More... | |
Real * | val |
Values of vector. More... | |
Dense vector with semi-sparse vector for updates
In many algorithms vectors are updated in every iteration, by adding a multiple of another vector to it, i.e., given a vector x
, a scalar \(\alpha\) and another vector \(\delta\), the update to x
constists of substituting it by \(x \leftarrow x + \alpha\cdot\delta\).
While the update itself can easily be expressed with methods of the class Vector, it is often desirable to save the last update vector \(\delta\) and value \(\alpha\). This is provided by class UpdateVector.
UpdateVectors are derived from DVector and provide additional methods for saving and setting the multiplicator \(\alpha\) and the update vector \(\delta\). Further, it allows for efficient sparse updates, by providing an IdxSet idx() containing the nonzero indices of \(\delta\).
Definition at line 53 of file updatevector.h.
|
explicit |
default constructor.
Definition at line 71 of file updatevector.h.
References UpdateVector::isConsistent().
Referenced by UpdateVector::~UpdateVector().
~UpdateVector | ( | ) |
Definition at line 79 of file updatevector.h.
References UpdateVector::UpdateVector().
UpdateVector | ( | const UpdateVector & | base | ) |
copy constructor
Definition at line 35 of file updatevector.cpp.
References UpdateVector::isConsistent().
void clear | ( | ) |
clear vector and update vector
Definition at line 153 of file updatevector.h.
References VectorBase< Real >::clear(), and UpdateVector::clearUpdate().
Referenced by SPxSolver::clear().
void clearUpdate | ( | ) |
clear \(\delta\), \(\alpha\)
Definition at line 160 of file updatevector.h.
References SSVectorBase< R >::clear().
Referenced by UpdateVector::clear(), and SPxSolver::clearUpdateVecs().
SSVector& delta | ( | ) |
update vector \(\delta\), writeable
Definition at line 122 of file updatevector.h.
References UpdateVector::thedelta.
Referenced by SPxSolver::computeDualfarkas4Col(), SPxSolver::computeDualfarkas4Row(), SPxSolver::computePrimalray4Col(), SPxSolver::computePrimalray4Row(), SPxSolver::enter(), SPxDevexPR::entered4(), SPxSteepPR::entered4(), SPxBoundFlippingRT::flipAndUpdate(), SPxSolver::getEnterVals2(), SPxSolver::getLeaveVals2(), SPxSolver::isConsistent(), SPxSolver::leave(), SPxDevexPR::left4(), SPxSteepPR::left4(), SPxFastRT::maxDelta(), SPxFastRT::maxReEnter(), SPxFastRT::maxReLeave(), SPxFastRT::maxSelect(), SPxFastRT::maxShortLeave(), SPxFastRT::minDelta(), SPxFastRT::minReEnter(), SPxFastRT::minReLeave(), SPxFastRT::minSelect(), SPxFastRT::minShortLeave(), SPxSolver::perturbMax(), SPxSolver::perturbMaxEnter(), SPxSolver::perturbMaxLeave(), SPxSolver::perturbMin(), SPxSolver::perturbMinEnter(), SPxSolver::perturbMinLeave(), SPxDefaultRT::selectEnter(), SPxHarrisRT::selectEnter(), SPxSteepPR::selectEnter(), SPxFastRT::selectEnter(), SPxBoundFlippingRT::selectEnter(), SPxDefaultRT::selectLeave(), SPxHarrisRT::selectLeave(), SPxSteepPR::selectLeave(), SPxFastRT::selectLeave(), SPxBoundFlippingRT::selectLeave(), SPxSolver::setupPupdate(), SPxFastRT::shortEnter(), SPxSolver::updateCoTest(), and SPxSolver::updateTest().
const SSVector& delta | ( | ) | const |
update vector \(\delta\)
Definition at line 127 of file updatevector.h.
References UpdateVector::thedelta.
const IdxSet& idx | ( | ) | const |
nonzero indices of update vector \(\delta\)
Definition at line 133 of file updatevector.h.
References SSVectorBase< R >::indices().
Referenced by SPxDevexPR::entered4(), SPxSteepPR::entered4(), SPxDevexPR::left4(), SPxSteepPR::left4(), SPxDefaultRT::selectEnter(), SPxDefaultRT::selectLeave(), SPxSolver::updateCoTest(), SPxSolver::updateFtest(), and SPxSolver::updateTest().
bool isConsistent | ( | ) | const |
Definition at line 43 of file updatevector.cpp.
References VectorBase< Real >::dim(), SSVectorBase< R >::dim(), DVectorBase< Real >::isConsistent(), SSVectorBase< R >::isConsistent(), MSGinconsistent, and UpdateVector::thedelta.
Referenced by SPxSolver::enter(), SPxSolver::isConsistent(), SPxSolver::leave(), UpdateVector::operator=(), UpdateVector::reDim(), and UpdateVector::UpdateVector().
UpdateVector& operator= | ( | const DVector & | rhs | ) |
assignment from DVector
Definition at line 84 of file updatevector.h.
References UpdateVector::isConsistent(), and DVectorBase< Real >::operator=().
Referenced by UpdateVector::operator=().
UpdateVector& operator= | ( | const Vector & | rhs | ) |
assignment from Vector
Definition at line 94 of file updatevector.h.
References UpdateVector::isConsistent(), UpdateVector::operator=(), and DVectorBase< Real >::operator=().
UpdateVector & operator= | ( | const UpdateVector & | rhs | ) |
assignment
Definition at line 21 of file updatevector.cpp.
References UpdateVector::isConsistent(), DVectorBase< Real >::operator=(), UpdateVector::thedelta, and UpdateVector::theval.
void reDim | ( | int | newdim | ) |
reset dimension
Definition at line 167 of file updatevector.h.
References UpdateVector::isConsistent(), DVectorBase< Real >::reDim(), and SSVectorBase< R >::reDim().
Referenced by SPxSolver::reDim().
void update | ( | ) |
Perform the update.
Add value()
* delta()
to the UpdateVector. Only the indices in idx() are affected. For all other indices, delta() is asumed to be 0.
Definition at line 147 of file updatevector.h.
References VectorBase< Real >::multAdd().
Referenced by SPxSolver::doPupdate(), SPxSolver::enter(), and SPxSolver::leave().
Real& value | ( | ) |
update multiplicator \(\alpha\), writeable
Definition at line 111 of file updatevector.h.
References UpdateVector::theval.
Referenced by SPxSolver::enter(), and SPxSolver::leave().
Real value | ( | ) | const |
update multiplicator \(\alpha\)
Definition at line 116 of file updatevector.h.
References UpdateVector::theval.
|
private |
update vector
Definition at line 61 of file updatevector.h.
Referenced by UpdateVector::delta(), UpdateVector::isConsistent(), and UpdateVector::operator=().
|
private |
update multiplicator
Definition at line 60 of file updatevector.h.
Referenced by UpdateVector::operator=(), and UpdateVector::value().