Scippy

SoPlex

Sequential object-oriented simPlex

DVectorBase< R > Class Template Reference

Dynamic dense vectors.Class DVectorBase is a derived class of VectorBase adding automatic memory management to such objects. This allows to implement maths operations operator+() and operator-(). Further, it is possible to reset the dimension of a DVectorBase via method reDim(). However, this may render all references to values of a reDim()ed DVectorBase invalid. More...

#include <dvectorbase.h>

Public Member Functions

template<>
void reSize (int newsize)
 Resets DVectorBase's memory size to newsize (specialization for Real). More...
 
Construction, destruction, and assignment
 DVectorBase (int d=0)
 Default constructor. d is the initial dimension. More...
 
template<class S >
 DVectorBase (const VectorBase< S > &old)
 Copy constructor. More...
 
 DVectorBase (const DVectorBase< R > &old)
 Copy constructor. More...
 
template<class S >
 DVectorBase (const DVectorBase< S > &old)
 Copy constructor. More...
 
DVectorBase< R > & operator= (const VectorBase< R > &vec)
 Assignment operator. More...
 
template<class S >
DVectorBase< R > & operator= (const VectorBase< S > &vec)
 Assignment operator. More...
 
DVectorBase< R > & operator= (const DVectorBase< R > &vec)
 Assignment operator. More...
 
template<class S >
DVectorBase< R > & operator= (const DVectorBase< S > &vec)
 Assignment operator. More...
 
template<class S >
DVectorBase< R > & operator= (const SVectorBase< S > &vec)
 Assignment operator. More...
 
virtual ~DVectorBase ()
 Destructor. More...
 
Access and modification
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...
 
Utilities
bool isConsistent () const
 Consistency check. More...
 
- Public Member Functions inherited from VectorBase< R >
template<>
VectorBase< Real > & operator= (const VectorBase< Real > &vec)
 Assignment operator (specialization for Real). More...
 
template<>
VectorBase< Real > & operator= (const VectorBase< Rational > &vec)
 Assignment operator (specialization for Real). More...
 
template<>
void clear ()
 Set vector to 0 (specialization for Real). More...
 
template<>
Rational operator* (const VectorBase< Rational > &vec) const
 Inner product. More...
 
 VectorBase (int p_dimen, R *p_val)
 Constructor. More...
 
template<class S >
VectorBase< R > & operator= (const VectorBase< S > &vec)
 Assignment operator. More...
 
VectorBase< R > & operator= (const VectorBase< R > &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...
 
template<class S >
VectorBase< R > & operator= (const SVectorBase< S > &vec)
 Assignment operator. More...
 
template<class S >
VectorBase< R > & operator= (const SSVectorBase< S > &vec)
 Assignment operator. More...
 
template<class S >
VectorBase< R > & assign (const SVectorBase< S > &vec)
 Assign values of vec. More...
 
template<class S >
VectorBase< R > & assign (const SSVectorBase< S > &vec)
 Assign values of vec. More...
 
void clear ()
 Set vector to 0. More...
 
template<class S >
VectorBase< R > & operator+= (const VectorBase< S > &vec)
 Addition. More...
 
template<class S >
VectorBase< R > & operator+= (const SVectorBase< S > &vec)
 Addition. More...
 
template<class S >
VectorBase< R > & operator+= (const SSVectorBase< S > &vec)
 Addition. More...
 
template<class S >
VectorBase< R > & operator-= (const VectorBase< S > &vec)
 Subtraction. More...
 
template<class S >
VectorBase< R > & operator-= (const SVectorBase< S > &vec)
 Subtraction. More...
 
template<class S >
VectorBase< R > & operator-= (const SSVectorBase< S > &vec)
 Subtraction. More...
 
template<class S >
VectorBase< R > & operator*= (const S &x)
 Scaling. More...
 
template<class S >
VectorBase< R > & operator/= (const S &x)
 Division. More...
 
operator* (const VectorBase< R > &vec) const
 Inner product. More...
 
operator* (const SVectorBase< R > &vec) const
 Inner product. More...
 
operator* (const SSVectorBase< R > &vec) const
 Inner product. More...
 
maxAbs () const
 Maximum absolute value, i.e., infinity norm. More...
 
minAbs () const
 Minimum absolute value. More...
 
Real length () const
 Floating point approximation of euclidian norm (without any approximation guarantee). More...
 
length2 () const
 Squared norm. More...
 
template<class S , class T >
VectorBase< R > & multAdd (const S &x, const VectorBase< T > &vec)
 Addition of scaled vector. More...
 
template<class S , class T >
VectorBase< R > & multAdd (const S &x, const SVectorBase< T > &vec)
 Addition of scaled vector. More...
 
template<class S , class T >
VectorBase< R > & multSub (const S &x, const SVectorBase< T > &vec)
 Subtraction of scaled vector. More...
 
template<class S , class T >
VectorBase< R > & multAdd (const S &x, const SSVectorBase< T > &vec)
 Addition of scaled vector. More...
 
R * get_ptr ()
 Conversion to C-style pointer. More...
 
const R * get_const_ptr () const
 Conversion to C-style pointer. More...
 
bool isConsistent () const
 Consistency check. More...
 
int dim () const
 Dimension of vector. More...
 
R & operator[] (int n)
 Return n 'th value by reference. More...
 
const R & operator[] (int n) const
 Return n 'th value. More...
 

Private Member Functions

template<>
 DVectorBase (int d)
 Default constructor with d as the initial dimension (specialization for Real). More...
 
template<>
 DVectorBase (const VectorBase< Real > &old)
 Copy constructor (specialization for Real). More...
 
template<>
 DVectorBase (const DVectorBase< Real > &old)
 Copy constructor (specialization for Real). More...
 

Private Attributes

Data
int memsize
 Length of array of values mem. More...
 
R * mem
 Array of values. More...
 

Friends

template<class S >
class DVectorBase
 

Additional Inherited Members

- Protected Attributes inherited from VectorBase< R >
int dimen
 Dimension of vector. More...
 
R * val
 Values of vector. More...
 

Detailed Description

template<class R>
class soplex::DVectorBase< R >

Dynamic dense vectors.

Class DVectorBase is a derived class of VectorBase adding automatic memory management to such objects. This allows to implement maths operations operator+() and operator-(). Further, it is possible to reset the dimension of a DVectorBase via method reDim(). However, this may render all references to values of a reDim()ed DVectorBase invalid.

For vectors that are often subject to reDim() it may be unconvenient to reallocate the required memory every time. Instead, an array of values of length memSize() is kept, where only the first dim() elements are used. Initially, memSize() == dim(). However, if the dimension is increased, memSize() will be increased at least by a factor of 1.2 to be prepared for future (small) reDim()s. Finally, one can explicitly set memSize() with method reSize(), but not lower than dim().

Definition at line 48 of file dvectorbase.h.

Constructor & Destructor Documentation

◆ DVectorBase() [1/7]

DVectorBase ( int  d = 0)
explicit

Default constructor. d is the initial dimension.

Definition at line 73 of file dvectorbase.h.

◆ DVectorBase() [2/7]

DVectorBase ( const VectorBase< S > &  old)
explicit

Copy constructor.

Definition at line 92 of file dvectorbase.h.

◆ DVectorBase() [3/7]

DVectorBase ( const DVectorBase< R > &  old)

Copy constructor.

The redundancy with the copy constructor below is necessary since otherwise the compiler doesn't realize that it could use the more general one with S = R and generates a shallow copy constructor.

Definition at line 116 of file dvectorbase.h.

◆ DVectorBase() [4/7]

DVectorBase ( const DVectorBase< S > &  old)

Copy constructor.

Definition at line 138 of file dvectorbase.h.

◆ ~DVectorBase()

virtual ~DVectorBase ( )
virtual

Destructor.

Definition at line 229 of file dvectorbase.h.

◆ DVectorBase() [5/7]

DVectorBase ( int  d)
private

Default constructor with d as the initial dimension (specialization for Real).

Definition at line 343 of file dvectorbase.h.

◆ DVectorBase() [6/7]

DVectorBase ( const VectorBase< Real > &  old)
private

Copy constructor (specialization for Real).

Definition at line 361 of file dvectorbase.h.

◆ DVectorBase() [7/7]

DVectorBase ( const DVectorBase< Real > &  old)
private

Copy constructor (specialization for Real).

Definition at line 379 of file dvectorbase.h.

Member Function Documentation

◆ isConsistent()

◆ memSize()

int memSize ( ) const

Returns DVectorBase's memory size.

Definition at line 247 of file dvectorbase.h.

◆ operator=() [1/5]

DVectorBase<R>& operator= ( const VectorBase< R > &  vec)

Assignment operator.

Definition at line 159 of file dvectorbase.h.

Referenced by DVectorBase< Real >::operator=().

◆ operator=() [2/5]

DVectorBase<R>& operator= ( const VectorBase< S > &  vec)

Assignment operator.

Definition at line 176 of file dvectorbase.h.

◆ operator=() [3/5]

DVectorBase<R>& operator= ( const DVectorBase< R > &  vec)

Assignment operator.

Definition at line 192 of file dvectorbase.h.

◆ operator=() [4/5]

DVectorBase<R>& operator= ( const DVectorBase< S > &  vec)

Assignment operator.

Definition at line 209 of file dvectorbase.h.

◆ operator=() [5/5]

DVectorBase< R > & operator= ( const SVectorBase< S > &  vec)

Assignment operator.

Definition at line 344 of file basevectors.h.

◆ reDim()

void reDim ( int  newdim,
const bool  setZero = true 
)

Resets DVectorBase's dimension to newdim.

Definition at line 253 of file dvectorbase.h.

Referenced by SoPlex::_checkOriginalProblemOptimality(), SoPlex::_computeReducedProbObjCoeff(), SoPlex::_factorizeColumnRational(), SoPlex::_performOptIRStable(), SoPlex::_project(), SoPlex::_reconstructSolutionRational(), SoPlex::_solveDecompositionDualSimplex(), SoPlex::_storeLPReal(), SoPlex::_storeSolutionReal(), SoPlex::_storeSolutionRealFromPresol(), SoPlex::_transformFeasibility(), SoPlex::_transformUnbounded(), SoPlex::_untransformEquality(), SoPlex::_untransformFeasibility(), SoPlex::_untransformUnbounded(), LPColSetBase< Rational >::add(), LPRowSetBase< Real >::add(), SPxDevexPR::addedCoVecs(), SPxWeightPR::addedCoVecs(), SPxSteepPR::addedCoVecs(), SPxDevexPR::addedVecs(), SPxWeightPR::addedVecs(), SPxSteepPR::addedVecs(), SLUFactorRational::assign(), CLUFactorRational::Temp::clear(), SLUFactorRational::clear(), LPColSetBase< Rational >::clear(), LPRowSetBase< Real >::clear(), LPColSetBase< Rational >::create(), LPRowSetBase< Real >::create(), CLUFactorRational::forestMinColMem(), SLUFactorRational::freeAll(), CLUFactorRational::Temp::init(), SPxWeightPR::load(), SLUFactor::load(), SLUFactorRational::load(), CLUFactorRational::minLMem(), CLUFactorRational::minRowMem(), DVectorBase< Real >::operator=(), SSVectorBase< Real >::operator=(), soplex::operator>>(), soplex::reconstructSol(), SSVectorBase< Real >::reDim(), SPxSolver::reDim(), LPColSetBase< Rational >::remove(), LPRowSetBase< Real >::remove(), SPxWeightPR::removedCoVec(), SPxSteepPR::removedCoVec(), SPxWeightPR::removedCoVecs(), SPxSteepPR::removedCoVecs(), SPxWeightPR::removedVec(), SPxSteepPR::removedVec(), SPxWeightPR::removedVecs(), SPxSteepPR::removedVecs(), SPxSolver::setDualNorms(), SPxParMultPR::setType(), SPxPricer::setType(), SPxWeightPR::setType(), SSVectorBase< Real >::setup_and_assign(), CLUFactorRational::setupColVals(), SPxSumST::setupWeights(), SPxSteepPR::setupWeights(), SPxDevexPR::setupWeights(), SPxMainSM::simplify(), SLUFactorRational::SLUFactorRational(), and SPxMainSM::unsimplify().

◆ reSize() [1/2]

void reSize ( int  newsize)

◆ reSize() [2/2]

void reSize ( int  newsize)

Resets DVectorBase's memory size to newsize (specialization for Real).

Definition at line 328 of file dvectorbase.h.

Friends And Related Function Documentation

◆ DVectorBase

friend class DVectorBase
friend

Definition at line 50 of file dvectorbase.h.

Member Data Documentation

◆ mem

R* mem
private

Array of values.

Definition at line 62 of file dvectorbase.h.

Referenced by DVectorBase< Real >::DVectorBase(), and DVectorBase< Real >::reSize().

◆ memsize

int memsize
private

Length of array of values mem.

Definition at line 59 of file dvectorbase.h.

Referenced by DVectorBase< Real >::DVectorBase(), DVectorBase< Real >::memSize(), and DVectorBase< Real >::reSize().