PIPS-NLP
Public Member Functions | Public Attributes | Protected Attributes | List of all members
StochVector Class Reference

#include <StochVector.h>

Inheritance diagram for StochVector:
OoqpVector IotrRefCount StochDummyVector

Public Member Functions

 StochVector (int n, MPI_Comm mpiComm, int isDistributed=-1)
 
 StochVector (int n, int const treeIDX_in, MPI_Comm mpiComm, int isDistributed=-1)
 
virtual ~StochVector ()
 
void AddChild (StochVector *child)
 
void AddChild (OoqpVector *child)
 
virtual OoqpVectordataClone () const
 
virtual StochVectorclone () const
 
virtual void jointCopyFrom (StochVector &v1, StochVector &v2, StochVector &v3)
 
virtual void jointCopyTo (StochVector &v1, StochVector &v2, StochVector &v3)
 
virtual void jointCopyFromXSYZ (StochVector &v1, StochVector &v2, StochVector &v3, StochVector &v4)
 
virtual void jointCopyToXSYZ (StochVector &v1, StochVector &v2, StochVector &v3, StochVector &v4)
 
virtual int isKindOf (int kind)
 
virtual void setToZero ()
 
virtual void setToConstant (double c)
 
virtual void randomize (double alpha, double beta, double *ix)
 
virtual void copyFrom (OoqpVector &v)
 
virtual double twonorm ()
 
virtual double infnorm ()
 
virtual double onenorm ()
 
virtual void min (double &m, int &index)
 
virtual double stepbound (OoqpVector &v, double maxStep)
 
virtual double findBlocking (OoqpVector &wstep_vec, OoqpVector &u_vec, OoqpVector &ustep_vec, double maxStep, double *w_elt, double *wstep_elt, double *u_elt, double *ustep_elt, int &first_or_second)
 
virtual void componentMult (OoqpVector &v)
 
virtual void componentDiv (OoqpVector &v)
 
virtual void scalarMult (double num)
 
virtual void writeToStream (std::ostream &out) const
 
virtual void writefToStream (std::ostream &out, const char format[]) const
 
virtual void scale (double alpha)
 
virtual void axpy (double alpha, OoqpVector &x)
 
virtual void axzpy (double alpha, OoqpVector &x, OoqpVector &z)
 
virtual void axdzpy (double alpha, OoqpVector &x, OoqpVector &z)
 
virtual void addConstant (double c)
 
virtual void gondzioProjection (double rmin, double rmax)
 
virtual double dotProductWith (OoqpVector &v)
 
virtual double shiftedDotProductWith (double alpha, OoqpVector &mystep, OoqpVector &yvec, double beta, OoqpVector &ystep)
 
virtual void negate ()
 
virtual void invert ()
 
virtual int allPositive ()
 
virtual int matchesNonZeroPattern (OoqpVector &select)
 
virtual void selectNonZeros (OoqpVector &select)
 
virtual long long numberOfNonzeros ()
 
virtual void addSomeConstants (double c, OoqpVector &select)
 
virtual void writefSomeToStream (std::ostream &out, const char format[], OoqpVector &select) const
 
virtual void axdzpy (double alpha, OoqpVector &x, OoqpVector &z, OoqpVector &select)
 
virtual int somePositive (OoqpVector &select)
 
virtual void divideSome (OoqpVector &div, OoqpVector &select)
 
virtual void copyIntoArray (double v[])
 
virtual void copyFromArray (double v[])
 
virtual void copyFromArray (char v[])
 
int getSize ()
 
virtual void print ()
 
virtual void findBlockingPD (OoqpVector &wstep_vec, OoqpVector &u_vec, OoqpVector &ustep_vec, double *w_elt, double *wstep_elt, double *u_elt, double *ustep_elt, int &first_or_second, double *alphaPri, double *alphaDual)
 
virtual double sumLog (OoqpVector *select)
 
virtual double sumPowElt (const double pow_in)
 
virtual double sumElt ()
 
virtual void MinComponentOrConstant (OoqpVector *vec_in, double minVal)
 
virtual void correctLargeVal (const double testVal, const double corVal, const int absFlag)
 
virtual void MinComponentBetween (OoqpVector *vec_in, OoqpVector *select_in=NULL)
 
virtual void setToConstantFromTo (double c, int start, int end)
 
virtual void SetComponentFromMaxXorY (OoqpVector *x_in, OoqpVector *y_in, OoqpVector *select_in=NULL)
 
virtual void SetComponentFromMaxXorY (OoqpVector *x_in, OoqpVector *y_in, int Start, int End, int xStart, int xEnd, int yStart, int yEnd)
 
virtual void SetComponentFromMaxXorConstant (OoqpVector *x_in, const double y_in)
 
virtual void SetComponentFromMaxXorConstant (OoqpVector *x_in, const double y_in, int Start, int End, int xStart, int xEnd)
 
virtual void copyFromFromTo (OoqpVector *vec_in, int VStart, int VEnd, int VinStart, int VinEnd)
 
virtual void copyFromArrayFromTo (double *w, int VStart, int VEnd, int Wstart, int Wend)
 
virtual void copyIntoArrayFromTo (double *w, int VStart, int VEnd, int Wstart, int Wend)
 
virtual void absVal (OoqpVector *vec_in)
 
virtual void copyIntoArrayWithIndex_AggVarCon (double *ResultArray, const int *vecmap, const int length, bool isVar=true)
 
- Public Member Functions inherited from OoqpVector
long long length () const
 
 OoqpVector (int n_=0)
 
virtual ~OoqpVector ()
 
double Norm (const int Norm_Type, OoqpVector *vec2=NULL)
 
double Norm (const int Norm_Type, const double norm1, const double norm2)
 
- Public Member Functions inherited from IotrRefCount
int refs ()
 
 IotrRefCount ()
 

Public Attributes

int treeIDX
 
OoqpVectorvec
 
std::vector< StochVector * > children
 
StochVectorparent
 
MPI_Comm mpiComm
 
int iAmDistrib
 
- Public Attributes inherited from OoqpVector
int n
 

Protected Attributes

bool firstDoNumOfNonZero
 
int nnzNonZeros
 

Additional Inherited Members

- Static Public Member Functions inherited from IotrRefCount
static void release (IotrRefCount **obj)
 
static void addRef (IotrRefCount *const *obj)
 
- Static Public Attributes inherited from IotrRefCount
static int instances = 0
 
- Protected Member Functions inherited from IotrRefCount
virtual ~IotrRefCount ()
 

Constructor & Destructor Documentation

StochVector::StochVector ( int  n,
MPI_Comm  mpiComm,
int  isDistributed = -1 
)
StochVector::StochVector ( int  n,
int const  treeIDX_in,
MPI_Comm  mpiComm,
int  isDistributed = -1 
)
StochVector::~StochVector ( )
virtual

Member Function Documentation

void StochVector::absVal ( OoqpVector vec_in)
virtual

Return the absolute value

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::AddChild ( StochVector child)
void StochVector::AddChild ( OoqpVector child)
void StochVector::addConstant ( double  c)
virtual

Add c to the elements of this OoqpVector object

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::addSomeConstants ( double  c,
OoqpVector select 
)
virtual

Add the constant c to some of the elements of this OoqpVector

Parameters
cThe constant to be added
selecta mask OoqpVector. The constant c is added to an element of this OoqpVector only if the corresponding element of select is non-zero.

Implements OoqpVector.

Reimplemented in StochDummyVector.

int StochVector::allPositive ( )
virtual

True if all elements of this OoqpVector are positive.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::axdzpy ( double  alpha,
OoqpVector x_,
OoqpVector z_ 
)
virtual

this += alpha * x / z

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::axdzpy ( double  alpha,
OoqpVector x,
OoqpVector z,
OoqpVector select 
)
virtual

this += alpha * x / z

Parameters
selectonly perform the division on elements of x and z if the corresponding element of select is non-zero. Generally we avoid performing the division if we know that it will result in division by zero. The OoqpVector select may be x, z or a third OoqpVector.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::axpy ( double  alpha,
OoqpVector x_ 
)
virtual

this += alpha * x

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::axzpy ( double  alpha,
OoqpVector x_,
OoqpVector z_ 
)
virtual

this += alpha * x * z

Implements OoqpVector.

Reimplemented in StochDummyVector.

StochVector * StochVector::clone ( ) const
virtual

Reimplemented in StochDummyVector.

void StochVector::componentDiv ( OoqpVector v)
virtual

Divide the components of this OoqpVector by the components of v.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::componentMult ( OoqpVector v)
virtual

Multiply the components of this OoqpVector by the components of v.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyFrom ( OoqpVector v)
virtual

Copy the elements of v into this OoqpVector object.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyFromArray ( double  v[])
virtual

Copy the elements of the C-style array v into this OoqpVector.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyFromArray ( char  v[])
virtual

Copy the elements of the C-style char array v into this OoqpVector.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyFromArrayFromTo ( double *  w,
int  VStart,
int  VEnd,
int  Wstart,
int  Wend 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyFromFromTo ( OoqpVector vec_in,
int  VStart,
int  VEnd,
int  VinStart,
int  VinEnd 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyIntoArray ( double  v[])
virtual

Copy the elements of this OoqpVector into the C-style array v.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::copyIntoArrayFromTo ( double *  w,
int  VStart,
int  VEnd,
int  Wstart,
int  Wend 
)
virtual

Reimplemented in StochDummyVector.

void StochVector::copyIntoArrayWithIndex_AggVarCon ( double *  ResultArray,
const int *  vecmap,
const int  length,
bool  isVar = true 
)
virtual

Reimplemented from OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::correctLargeVal ( const double  testVal,
const double  corVal,
const int  absFlag 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

OoqpVector * StochVector::dataClone ( ) const
virtual

Creates and returns a vector of the type used to store data in this node, i.e., same type as 'vec'. NO data is copied, for this use one of the 'copy...' functions.

Reimplemented in StochDummyVector.

void StochVector::divideSome ( OoqpVector div,
OoqpVector select 
)
virtual

Divide selected elements of this OoqpVector by the corresponding element in div.

Parameters
divIf element i of this OoqpVector is selected, then it will be divided by element i of div.
selectPerform division on elements of this OoqpVector only if the corresponding element in select is non-zero

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::dotProductWith ( OoqpVector v)
virtual

Return the dot product of this OoqpVector with v

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::findBlocking ( OoqpVector wstep_vec,
OoqpVector u_vec,
OoqpVector ustep_vec,
double  maxStep,
double *  w_elt,
double *  wstep_elt,
double *  u_elt,
double *  ustep_elt,
int &  first_or_second 
)
virtual

Return the largest value of alpha in the interval [0,1] for which: this + alpha * wstep_vec >= 0 and u_vec + alpha * ustep_vec >= 0. Also return the components this[i], wstep_vec[i], u_vec[i], ustep_vec[i], where i is the index of the "blocking" component - the one that limits the step length to alpha. Also return first_or_second=1 if the blocking component is in "this", and first_or_second=2 if the blocking component is in u_vec.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::findBlockingPD ( OoqpVector wstep_vec,
OoqpVector u_vec,
OoqpVector ustep_vec,
double *  w_elt,
double *  wstep_elt,
double *  u_elt,
double *  ustep_elt,
int &  first_or_second,
double *  alphaPri,
double *  alphaDual 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

int StochVector::getSize ( )
inline
void StochVector::gondzioProjection ( double  rmin,
double  rmax 
)
virtual

Perform the projection needed by Gondzio's multiple corrector method.

See also
SimpleVector::gondzioProjection

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::infnorm ( )
virtual

Return the infinity norm of this OoqpVector object.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::invert ( )
virtual

Invert (1/x) the elements of this OoqpVector.

Implements OoqpVector.

Reimplemented in StochDummyVector.

int StochVector::isKindOf ( int  kind)
virtual

True if this OoqpVector identifies itself as having the type kind.

Classes overriding this method must call the inherited version, so that the class hierarchy is supported.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::jointCopyFrom ( StochVector v1,
StochVector v2,
StochVector v3 
)
virtual

Reimplemented in StochDummyVector.

void StochVector::jointCopyFromXSYZ ( StochVector v1,
StochVector v2,
StochVector v3,
StochVector v4 
)
virtual

Reimplemented in StochDummyVector.

void StochVector::jointCopyTo ( StochVector v1,
StochVector v2,
StochVector v3 
)
virtual

Reimplemented in StochDummyVector.

void StochVector::jointCopyToXSYZ ( StochVector v1,
StochVector v2,
StochVector v3,
StochVector v4 
)
virtual

Reimplemented in StochDummyVector.

int StochVector::matchesNonZeroPattern ( OoqpVector select)
virtual

True if this OoqpVector has the same non-zero pattern as select.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::min ( double &  m,
int &  index 
)
virtual

Return the minimum value in this vector, and the index at which it occurs.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::MinComponentBetween ( OoqpVector vec_in,
OoqpVector select_in = NULL 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::MinComponentOrConstant ( OoqpVector vec_in,
double  minVal 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::negate ( )
virtual

Negate all the elements of this OoqpVector object.

Implements OoqpVector.

Reimplemented in StochDummyVector.

long long StochVector::numberOfNonzeros ( )
virtual

Return the number of non-zero elements in this OoqpVector.

opt - store the number of nnz to avoid communication

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::onenorm ( )
virtual

Return the one norm of this OoqpVector object.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::print ( )
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::randomize ( double  alpha,
double  beta,
double *  ix 
)
virtual

Fill this OoqpVector with random elements

Parameters
alpha
betathe elements will be in the interval [alpha, beta]
ixan aribitray number used to seed the random number generator

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::scalarMult ( double  num)
virtual

Write the components of this OoqpVector, one element per line, to the stream out. Multiply the components of this OoqpVector by num.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::scale ( double  alpha)
virtual

Scale each element of this OoqpVector by the constant alpha

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::selectNonZeros ( OoqpVector select)
virtual

Set each element of this OoqpVector to zero if the corresponding element in select is zero.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::SetComponentFromMaxXorConstant ( OoqpVector x_in,
const double  y_in 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::SetComponentFromMaxXorConstant ( OoqpVector x_in,
const double  y_in,
int  Start,
int  End,
int  xStart,
int  xEnd 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::SetComponentFromMaxXorY ( OoqpVector x_in,
OoqpVector y_in,
OoqpVector select_in = NULL 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::SetComponentFromMaxXorY ( OoqpVector x_in,
OoqpVector y_in,
int  Start,
int  End,
int  xStart,
int  xEnd,
int  yStart,
int  yEnd 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::setToConstant ( double  c)
virtual

Set all elements of this OoqpVector to the constant value c

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::setToConstantFromTo ( double  c,
int  start,
int  end 
)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::setToZero ( )
virtual

Set all elements of this OoqpVector to zero.

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::shiftedDotProductWith ( double  alpha,
OoqpVector mystep_,
OoqpVector yvec_,
double  beta,
OoqpVector ystep_ 
)
virtual

Return the inner product <this + alpha * mystep, yvec + beta * ystep >

Implements OoqpVector.

Reimplemented in StochDummyVector.

int StochVector::somePositive ( OoqpVector select)
virtual

True if selected elements of this OoqpVector are positive

Parameters
selectEach element of this OoqpVector must be positive if the corresponding element of select is non-zero.

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::stepbound ( OoqpVector v,
double  maxStep 
)
virtual

Return the largest value of alpha in the interval [0, maxStep] for which: this + alpha * v >= 0. Set firstBlocking to be the "blocking" index i - the one that limits the step length to alpha.

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::sumElt ( )
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::sumLog ( OoqpVector select)
virtual

Implements OoqpVector.

double StochVector::sumPowElt ( const double  pow_in)
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

double StochVector::twonorm ( )
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::writefSomeToStream ( std::ostream &  out,
const char  format[],
OoqpVector select 
) const
virtual

Write some elements of this OoqpVector to a stream, subject to a format.

Parameters
outa C++-style output stream
formata string used to format the output. The substring %{index} will be substituted by the index of the current element and the string %{value} will be substituted with the element's value.
selecta mask OoqpVector. An element if this OoqpVector is written only if the corresponding element of selec is non-zero.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::writefToStream ( std::ostream &  out,
const char  format[] 
) const
virtual

Write the components of this OoqpVector to a stream, subject to a format.

Parameters
outa C++-style output stream
formata string used to format the output. The substring %{index} will be substituted by the index of the current element and the string %{value} will be substituted with the element's value.

Implements OoqpVector.

Reimplemented in StochDummyVector.

void StochVector::writeToStream ( std::ostream &  out) const
virtual

Implements OoqpVector.

Reimplemented in StochDummyVector.

Member Data Documentation

std::vector<StochVector*> StochVector::children

Children of this node

bool StochVector::firstDoNumOfNonZero
protected
int StochVector::iAmDistrib
MPI_Comm StochVector::mpiComm
int StochVector::nnzNonZeros
protected
StochVector* StochVector::parent

Link to the parent of this node. Needed when we multiply a matrix with this vector

int StochVector::treeIDX
OoqpVector* StochVector::vec

The data for this node.


The documentation for this class was generated from the following files: