Scippy

SoPlex

Sequential object-oriented simPlex

UpdateVector Class Reference

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...
 
UpdateVectoroperator= (const DVector &rhs)
 assignment from DVector More...
 
UpdateVectoroperator= (const Vector &rhs)
 assignment from Vector More...
 
UpdateVectoroperator= (const UpdateVector &rhs)
 assignment More...
 
Access
Realvalue ()
 update multiplicator \(\alpha\), writeable More...
 
Real value () const
 update multiplicator \(\alpha\) More...
 
SSVectordelta ()
 update vector \(\delta\), writeable More...
 
const SSVectordelta () const
 update vector \(\delta\) More...
 
const IdxSetidx () 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...
 
Realget_ptr ()
 Conversion to C-style pointer. More...
 
const Realget_const_ptr () const
 Conversion to C-style pointer. More...
 
bool isConsistent () const
 Consistency check. More...
 
int dim () const
 Dimension of vector. More...
 
Realoperator[] (int n)
 Return n 'th value by reference. More...
 
const Realoperator[] (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...
 
Realval
 Values of vector. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UpdateVector() [1/2]

UpdateVector ( int  p_dim,
Real  p_eps 
)
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() [2/2]

UpdateVector ( const UpdateVector base)

copy constructor

Definition at line 35 of file updatevector.cpp.

References UpdateVector::isConsistent().

Member Function Documentation

◆ clear()

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().

◆ clearUpdate()

void clearUpdate ( )

clear \(\delta\), \(\alpha\)

Definition at line 160 of file updatevector.h.

References SSVectorBase< R >::clear().

Referenced by UpdateVector::clear(), and SPxSolver::clearUpdateVecs().

◆ delta() [1/2]

◆ delta() [2/2]

const SSVector& delta ( ) const

update vector \(\delta\)

Definition at line 127 of file updatevector.h.

References UpdateVector::thedelta.

◆ idx()

◆ isConsistent()

◆ operator=() [1/3]

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=().

◆ operator=() [2/3]

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=().

◆ operator=() [3/3]

UpdateVector & operator= ( const UpdateVector rhs)

◆ reDim()

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().

◆ update()

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().

◆ value() [1/2]

Real& value ( )

update multiplicator \(\alpha\), writeable

Definition at line 111 of file updatevector.h.

References UpdateVector::theval.

Referenced by SPxSolver::enter(), and SPxSolver::leave().

◆ value() [2/2]

Real value ( ) const

update multiplicator \(\alpha\)

Definition at line 116 of file updatevector.h.

References UpdateVector::theval.

Member Data Documentation

◆ thedelta

SSVector thedelta
private

update vector

Definition at line 61 of file updatevector.h.

Referenced by UpdateVector::delta(), UpdateVector::isConsistent(), and UpdateVector::operator=().

◆ theval

Real theval
private

update multiplicator

Definition at line 60 of file updatevector.h.

Referenced by UpdateVector::operator=(), and UpdateVector::value().