Dense vector.Class VectorBase provides dense linear algebra vectors. It does not provide memory management for the array of values. Instead, the constructor requires a pointer to a memory block large enough to fit the desired dimension of Real or Rational values. More...
#include <dsvectorbase.h>
Public Member Functions | |
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... | |
Construction and assignment | |
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... | |
Arithmetic operations | |
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... | |
R | operator* (const VectorBase< R > &vec) const |
Inner product. More... | |
R | operator* (const SVectorBase< R > &vec) const |
Inner product. More... | |
R | operator* (const SSVectorBase< R > &vec) const |
Inner product. More... | |
R | maxAbs () const |
Maximum absolute value, i.e., infinity norm. More... | |
R | minAbs () const |
Minimum absolute value. More... | |
Real | length () const |
Floating point approximation of euclidian norm (without any approximation guarantee). More... | |
R | 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... | |
Utilities | |
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... | |
Protected Attributes | |
Data | |
int | dimen |
Dimension of vector. More... | |
R * | val |
Values of vector. More... | |
Access | |
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... | |
bool | operator== (const VectorBase< R > &vec1, const VectorBase< R > &vec2) |
Equality operator. More... | |
Dense vector.
Class VectorBase provides dense linear algebra vectors. It does not provide memory management for the array of values. Instead, the constructor requires a pointer to a memory block large enough to fit the desired dimension of Real or Rational values.
After construction, the values of a VectorBase can be accessed with the subscript operator[](). Safety is provided by qchecking of array bound when accessing elements with the subscript operator[]() (only when compiled without -DNDEBUG
).
A VectorBase is distinguished from a simple array of Reals or Rationals by providing a set of mathematical operations. Since VectorBase does not provide any memory management features, no operations are available that would require allocation of temporary memory space.
The following mathematical operations are provided by class VectorBase (VectorBase a
, b
; R x
):
Operation | Description | |
-= | subtraction | a -= b |
+= | addition | a += b |
* | scalar product | x = a * b |
*= | scaling | a *= x |
maxAbs() | infinity norm | a.maxAbs() == \(\|a\|_{\infty}\) |
minAbs() |
| |
length() | euclidian norm | a.length() == \(\sqrt{a^2}\) |
length2() | square norm | a.length2() == \(a^2\) |
multAdd(x ,b ) | add scaled vector | a += x * b |
When using any of these operations, the vectors involved must be of the same dimension. Also an SVectorBase b
is allowed if it does not contain nonzeros with index greater than the dimension of a.q
Definition at line 28 of file dsvectorbase.h.
VectorBase | ( | int | p_dimen, |
R * | p_val | ||
) |
Constructor.
There is no default constructor since the storage for a VectorBase must be provided externally. Storage must be passed as a memory block val at construction. It must be large enough to fit at least dimen values.
Definition at line 102 of file vectorbase.h.
VectorBase< R > & assign | ( | const SVectorBase< S > & | vec | ) |
Assign values of vec
.
Assigns all nonzeros of vec
to the vector. All other values remain unchanged.
Definition at line 80 of file basevectors.h.
Referenced by VectorBase< Real >::scaleAssign(), SLUFactorRational::solveRight(), and SLUFactor::solveRight().
VectorBase< R > & assign | ( | const SSVectorBase< S > & | vec | ) |
Assign values of vec
.
Assigns all nonzeros of vec
to the vector. All other values remain unchanged.
Definition at line 122 of file basevectors.h.
void clear | ( | ) |
Set vector to 0.
Definition at line 262 of file vectorbase.h.
Referenced by SoPlex::_checkBasisScaling(), SLUFactor::clear(), SLUFactorRational::clear(), SPxSolver::clear(), SSVectorBase< Real >::clear(), SPxLPBase< Real >::computeDualActivity(), SPxSolver::computeFrhs(), SPxLPBase< Real >::computePrimalActivity(), SPxBasis::coSolve(), SPxSolver::getDualfarkas(), SPxSolver::getPrimalray(), SPxSolver::getRedCost(), SPxBasis::multBaseWith(), SLUFactorRational::operator=(), SLUFactor::operator=(), SPxSumST::setupWeights(), SPxBasis::solve(), SLUFactorRational::solve2right4update(), SLUFactor::solve2right4update(), SLUFactorRational::solve3right4update(), SLUFactor::solve3right4update(), SLUFactorRational::solveLeft(), SLUFactor::solveLeft(), SLUFactor::solveRight(), SSVectorBase< Real >::SSVectorBase(), and SPxSolver::testVecs().
void clear | ( | ) |
Set vector to 0 (specialization for Real).
Definition at line 522 of file vectorbase.h.
int dim | ( | ) | const |
Dimension of vector.
Definition at line 217 of file vectorbase.h.
Referenced by SoPlex::_solveRealForRational(), LPColSetBase< Rational >::add(), LPRowSetBase< Real >::add(), SPxLPBase< Real >::addDualActivity(), SPxDevexPR::addedCoVecs(), SPxWeightPR::addedCoVecs(), SPxSteepPR::addedCoVecs(), SPxDevexPR::addedVecs(), SPxWeightPR::addedVecs(), SPxSteepPR::addedVecs(), SPxLPBase< Real >::addPrimalActivity(), SLUFactorRational::assign(), SSVectorBase< Real >::assign(), SPxLPBase< Real >::changeLhs(), SPxSolver::changeLower(), SPxLPBase< Real >::changeLower(), SPxLPBase< Real >::changeMaxObj(), SPxLPBase< Real >::changeRhs(), SPxLPBase< Real >::changeRowObj(), SPxSolver::changeUpper(), SPxLPBase< Real >::changeUpper(), SLUFactorRational::clear(), SPxLPBase< Real >::computeDualActivity(), SPxLPBase< Real >::computePrimalActivity(), SPxBasis::coSolve(), LPColSetBase< Rational >::create(), LPRowSetBase< Real >::create(), DSVectorBase< Real >::DSVectorBase(), DVectorBase< Real >::DVectorBase(), SPxWeightST::generate(), SoPlex::getBasisInverseTimesVecReal(), SoPlex::getBoundViolationRational(), SoPlex::getBoundViolationReal(), SoPlex::getDecompBoundViolation(), SoPlex::getDecompRowViolation(), SoPlex::getDualFarkasRational(), SoPlex::getDualFarkasReal(), SPxSolver::getDualNorms(), SoPlex::getDualRational(), SoPlex::getDualReal(), SoPlex::getDualViolationRational(), SoPlex::getDualViolationReal(), SPxScaler::getLhsUnscaled(), SPxScaler::getLowerUnscaled(), SPxScaler::getMaxObjUnscaled(), SPxSolver::getNdualNorms(), SoPlex::getPrimalRational(), SoPlex::getPrimalRayRational(), SoPlex::getPrimalRayReal(), SoPlex::getPrimalReal(), SoPlex::getRedCostRational(), SoPlex::getRedCostReal(), SoPlex::getRedCostViolationRational(), SoPlex::getRedCostViolationReal(), SPxScaler::getRhsUnscaled(), SoPlex::getRowViolationRational(), SoPlex::getRowViolationReal(), SoPlex::getSlacksRational(), SoPlex::getSlacksReal(), SPxScaler::getUpperUnscaled(), SPxWeightPR::isConsistent(), VectorBase< Real >::isConsistent(), LPColSetBase< Rational >::isConsistent(), LPRowSetBase< Real >::isConsistent(), SPxSolver::isConsistent(), soplex::LPFwriteObjective(), CLUFactorRational::makeLvec(), VectorBase< Real >::maxAbs(), SPxFastRT::maxDelta(), VectorBase< Real >::minAbs(), SPxFastRT::minDelta(), CLUFactorRational::minLMem(), CLUFactorRational::minRowMem(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), VectorBase< Real >::operator*(), soplex::operator*(), VectorBase< Real >::operator*=(), soplex::operator+(), VectorBase< Real >::operator+=(), soplex::operator-(), VectorBase< Real >::operator-=(), VectorBase< Real >::operator/=(), VectorBase< Real >::operator=(), DSVectorBase< Real >::operator=(), DVectorBase< Real >::operator=(), SVectorBase< Real >::operator=(), soplex::operator>>(), SPxSolver::perturbMax(), SPxSolver::perturbMin(), soplex::reconstructVector(), CLUFactorRational::remaxRow(), SPxWeightPR::removedCoVec(), SPxSteepPR::removedCoVec(), SPxWeightPR::removedCoVecs(), SPxSteepPR::removedCoVecs(), SPxWeightPR::removedVec(), SPxSteepPR::removedVec(), SPxWeightPR::removedVecs(), SPxSteepPR::removedVecs(), DVectorBase< Real >::reSize(), VectorBase< Real >::scaleAssign(), SPxScaler::scaleObj(), SPxDevexPR::selectEnterDenseCoDim(), SPxDevexPR::selectEnterDenseDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseDim(), SPxDevexPR::selectLeaveX(), SPxSolver::setDualNorms(), SPxSolver::setupPupdate(), SPxSteepPR::setupWeights(), SPxVectorST::setupWeights(), SLUFactorRational::SLUFactorRational(), SPxBasis::solve(), CLUFactorRational::solveLleftForest(), CLUFactorRational::solveLleftForestNoNZ(), CLUFactorRational::solveLleftNoNZ(), CLUFactorRational::solveUleft(), CLUFactorRational::solveUleftNoNZ(), CLUFactorRational::solveUpdateLeft(), SPxLPBase< Real >::subDualActivity(), SPxScaler::unscaleDual(), SPxScaler::unscaleDualray(), SPxScaler::unscalePrimal(), SPxScaler::unscalePrimalray(), SPxScaler::unscaleRedCost(), SPxScaler::unscaleSlacks(), SPxMainSM::unsimplify(), CLUFactorRational::vSolveUpdateRight(), and CLUFactorRational::vSolveUpdateRightNoNZ().
const R* get_const_ptr | ( | ) | const |
Conversion to C-style pointer.
This function serves for using a VectorBase in an C-style function. It returns a pointer to the first value of the array.
Definition at line 455 of file vectorbase.h.
Referenced by SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxDevexPR::buildBestPriceVectorLeave(), SPxSteepPR::buildBestPriceVectorLeave(), SPxSteepPR::entered4(), SPxSteepPR::left4(), SPxFastRT::maxDelta(), SPxFastRT::maxSelect(), SPxFastRT::minDelta(), SPxFastRT::minSelect(), SPxWeightPR::operator=(), SPxSolver::perturbMax(), SPxSolver::perturbMin(), SPxDefaultRT::selectEnter(), SPxHarrisRT::selectEnter(), SPxBoundFlippingRT::selectEnter(), SPxDevexPR::selectEnterDenseCoDim(), SPxSteepPR::selectEnterDenseCoDim(), SPxDevexPR::selectEnterDenseDim(), SPxSteepPR::selectEnterDenseDim(), SPxDevexPR::selectEnterHyperCoDim(), SPxSteepPR::selectEnterHyperCoDim(), SPxDevexPR::selectEnterHyperDim(), SPxSteepPR::selectEnterHyperDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxSteepPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseDim(), SPxSteepPR::selectEnterSparseDim(), SPxDefaultRT::selectLeave(), SPxHarrisRT::selectLeave(), SPxWeightPR::selectLeave(), SPxBoundFlippingRT::selectLeave(), SPxDevexPR::selectLeaveHyper(), SPxSteepPR::selectLeaveHyper(), SPxDevexPR::selectLeaveSparse(), SPxSteepPR::selectLeaveSparse(), SPxDevexPR::selectLeaveX(), SPxSteepPR::selectLeaveX(), SPxWeightPR::setRep(), and SPxWeightPR::SPxWeightPR().
R* get_ptr | ( | ) |
Conversion to C-style pointer.
This function serves for using a VectorBase in an C-style function. It returns a pointer to the first value of the array.
Definition at line 446 of file vectorbase.h.
Referenced by SoPlex::_checkBasisScaling(), SLUFactorRational::assign(), SLUFactor::assign(), SLUFactorRational::change(), SLUFactor::change(), SPxSteepPR::entered4(), SSVectorBase< Real >::get_ptr(), SPxSteepPR::left4(), SLUFactor::load(), SLUFactorRational::load(), SPxSumST::setupWeights(), SLUFactor::SLUFactor(), SLUFactorRational::SLUFactorRational(), SLUFactorRational::solve2right4update(), SLUFactor::solve2right4update(), SLUFactorRational::solve3right4update(), SLUFactor::solve3right4update(), SLUFactorRational::solveLeft(), SLUFactor::solveLeft(), SLUFactor::solveRight(), and SLUFactorRational::solveRight().
bool isConsistent | ( | ) | const |
Consistency check.
Definition at line 461 of file vectorbase.h.
Referenced by DVectorBase< Real >::isConsistent(), VectorBase< Real >::operator=(), VectorBase< Real >::scaleAssign(), and VectorBase< Real >::VectorBase().
Real length | ( | ) | const |
Floating point approximation of euclidian norm (without any approximation guarantee).
Definition at line 399 of file vectorbase.h.
Referenced by SPxSolver::enter(), SPxSolver::factorize(), SPxSolver::leave(), SPxSolver::terminate(), and SPxSolver::testVecs().
R length2 | ( | ) | const |
Squared norm.
Definition at line 405 of file vectorbase.h.
Referenced by SPxSteepPR::isConsistent(), VectorBase< Real >::length(), SSVectorBase< Real >::length2(), and SPxSteepPR::setupWeights().
R maxAbs | ( | ) | const |
Maximum absolute value, i.e., infinity norm.
Definition at line 357 of file vectorbase.h.
Referenced by SSVectorBase< Real >::maxAbs(), and SPxWeightST::setupWeights().
R minAbs | ( | ) | const |
Minimum absolute value.
Definition at line 378 of file vectorbase.h.
VectorBase<R>& multAdd | ( | const S & | x, |
const VectorBase< T > & | vec | ||
) |
Addition of scaled vector.
Definition at line 412 of file vectorbase.h.
Referenced by SoPlex::_factorizeColumnRational(), SoPlex::_untransformFeasibility(), SPxLPBase< Real >::addDualActivity(), SPxLPBase< Real >::addPrimalActivity(), SPxLPBase< Real >::computeDualActivity(), SPxSolver::computeFrhs(), SPxSolver::computeFrhs1(), SPxSolver::computeFrhsXtra(), SPxLPBase< Real >::computePrimalActivity(), SPxSolver::enter(), SPxSolver::leave(), SSVectorBase< Real >::multAdd(), SPxBasis::multBaseWith(), SPxSumST::setupWeights(), and SPxSolver::ungetEnterVal().
VectorBase< R > & multAdd | ( | const S & | x, |
const SVectorBase< T > & | vec | ||
) |
Addition of scaled vector.
Definition at line 276 of file basevectors.h.
VectorBase< R > & multAdd | ( | const S & | x, |
const SSVectorBase< T > & | vec | ||
) |
Addition of scaled vector.
Definition at line 310 of file basevectors.h.
VectorBase< R > & multSub | ( | const S & | x, |
const SVectorBase< T > & | vec | ||
) |
Subtraction of scaled vector.
Definition at line 293 of file basevectors.h.
Referenced by SPxLPBase< Real >::subDualActivity().
R operator* | ( | const VectorBase< R > & | vec | ) | const |
Inner product.
Definition at line 338 of file vectorbase.h.
R operator* | ( | const SVectorBase< R > & | vec | ) | const |
Inner product.
Definition at line 231 of file basevectors.h.
R operator* | ( | const SSVectorBase< R > & | vec | ) | const |
Inner product.
Definition at line 248 of file basevectors.h.
Rational operator* | ( | const VectorBase< Rational > & | vec | ) | const |
Inner product.
Definition at line 533 of file vectorbase.h.
VectorBase<R>& operator*= | ( | const S & | x | ) |
Scaling.
Definition at line 315 of file vectorbase.h.
VectorBase<R>& operator+= | ( | const VectorBase< S > & | vec | ) |
Addition.
Definition at line 273 of file vectorbase.h.
Referenced by VectorBase< Real >::operator+=(), and SSVectorBase< Real >::operator+=().
VectorBase< R > & operator+= | ( | const SVectorBase< S > & | vec | ) |
Addition.
Definition at line 148 of file basevectors.h.
VectorBase< R > & operator+= | ( | const SSVectorBase< S > & | vec | ) |
Addition.
Definition at line 166 of file basevectors.h.
VectorBase<R>& operator-= | ( | const VectorBase< S > & | vec | ) |
Subtraction.
Definition at line 294 of file vectorbase.h.
Referenced by VectorBase< Real >::operator-=(), and SSVectorBase< Real >::operator-=().
VectorBase< R > & operator-= | ( | const SVectorBase< S > & | vec | ) |
Subtraction.
Definition at line 190 of file basevectors.h.
VectorBase< R > & operator-= | ( | const SSVectorBase< S > & | vec | ) |
Subtraction.
Definition at line 208 of file basevectors.h.
VectorBase<R>& operator/= | ( | const S & | x | ) |
Division.
Definition at line 327 of file vectorbase.h.
VectorBase<R>& operator= | ( | const VectorBase< S > & | vec | ) |
Assignment operator.
Definition at line 112 of file vectorbase.h.
Referenced by DVectorBase< Real >::operator=(), SSVectorBase< Real >::operator=(), and VectorBase< Real >::scaleAssign().
VectorBase<R>& operator= | ( | const VectorBase< R > & | vec | ) |
Assignment operator.
Definition at line 128 of file vectorbase.h.
VectorBase< R > & operator= | ( | const SVectorBase< S > & | vec | ) |
Assignment operator.
Assigning an SVectorBase to a VectorBase using operator=() will set all values to 0 except the nonzeros of vec
. This is diffent in method assign().
Assigning an SVectorBase to a VectorBase using operator=() will set all values to 0 except the nonzeros of vec
. This is different in method assign().
Definition at line 58 of file basevectors.h.
VectorBase< R > & operator= | ( | const SSVectorBase< S > & | vec | ) |
Assignment operator.
Assigning an SSVectorBase to a VectorBase using operator=() will set all values to 0 except the nonzeros of vec
. This is diffent in method assign().
Assigning an SSVectorBase to a VectorBase using operator=() will set all values to 0 except the nonzeros of vec
. This is different in method assign().
Definition at line 102 of file basevectors.h.
VectorBase< Real > & operator= | ( | const VectorBase< Real > & | vec | ) |
Assignment operator (specialization for Real).
Definition at line 482 of file vectorbase.h.
VectorBase< Real > & operator= | ( | const VectorBase< Rational > & | vec | ) |
Assignment operator (specialization for Real).
Definition at line 502 of file vectorbase.h.
R& operator[] | ( | int | n | ) |
Return n
'th value by reference.
Definition at line 223 of file vectorbase.h.
const R& operator[] | ( | int | n | ) | const |
Return n
'th value.
Definition at line 230 of file vectorbase.h.
VectorBase<Real>& scaleAssign | ( | int | scaleExp, |
const VectorBase< Real > & | vec | ||
) |
scale and assign
Definition at line 144 of file vectorbase.h.
VectorBase<Real>& scaleAssign | ( | const int * | scaleExp, |
const VectorBase< Real > & | vec, | ||
bool | negateExp = false |
||
) |
scale and assign
Definition at line 160 of file vectorbase.h.
|
friend |
Equality operator.
Definition at line 237 of file vectorbase.h.
|
protected |
Dimension of vector.
Definition at line 84 of file vectorbase.h.
Referenced by VectorBase< Real >::clear(), VectorBase< Real >::dim(), VectorBase< Real >::maxAbs(), VectorBase< Real >::minAbs(), VectorBase< Real >::multAdd(), VectorBase< Real >::operator*(), VectorBase< Real >::operator*=(), VectorBase< Real >::operator+=(), VectorBase< Real >::operator-=(), VectorBase< Real >::operator=(), and VectorBase< Real >::scaleAssign().
|
protected |
Values of vector.
The memory block pointed to by val must at least have size dimen * sizeof(R).
Definition at line 88 of file vectorbase.h.
Referenced by VectorBase< Real >::assign(), SSVectorBase< Real >::assign2product1(), SSVectorBase< Real >::assign2productAndSetup(), SSVectorBase< Real >::assign2productFull(), SSVectorBase< Real >::assign2productShort(), SSVectorBase< Real >::assignPWproduct4setup(), VectorBase< Real >::clear(), VectorBase< Real >::get_const_ptr(), VectorBase< Real >::get_ptr(), VectorBase< Real >::multAdd(), VectorBase< Real >::operator*(), SSVectorBase< Real >::operator*(), VectorBase< Real >::operator=(), SSVectorBase< Real >::operator=(), DVectorBase< Real >::reSize(), and SSVectorBase< Real >::setup_and_assign().