Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

SimpleVector Class Reference
[DenseVectorAnalysis]

A subclass of the class IotrVector that stores a dense vector and supports vector operations. More...

#include <SimpleVector.hh>

Inheritance diagram for SimpleVector:

IotrVector IotrRefCount List of all members.

Public Methods

 SimpleVector (int n)
 Constructor.

 SimpleVector (double *v, int n)
 Constructor.

double * elements ()
 Return mElements.

double & operator[] (int i)
 Allows for vector[i] notation.

const double & operator[] (int i) const
 Allows for vector[i] notation.

virtual void copyFrom (const IotrVector &v)
virtual void copyFrom (const SimpleVector &v)
 Copy the elements of v.

virtual void copyInto (SimpleVector &v) const
 Copy the element of this into the SimpleVector v; for debugging and testing purposes only.

IotrVectorcopy () const
 Copy this vector, including data.

virtual IotrVectornewSibling () const
 create a new vector from the same space as this one

virtual void writefToStream (std::ostream &out, const char format[]) const
 Write the components of this OOQP_Vector to a stream, subject to a format.

virtual void setToConstant (double c)
 Set all elements to the constant value c.

virtual void setToZero ()
 Set all elements of this IotrVector to zero.

virtual void addConstant (double c)
 Add a constant value to all elements of this vector.

virtual void scale (double alpha)
 this = alpha * this

virtual void axpy (double alpha, const IotrVector &x)
 this += alpha * x

virtual void diagonalMult (double alpha, const IotrVector &x, double beta, IotrVector &y) const
 y = beta * y + alpha * this * x.

virtual void diagonalDiv (double alpha, const IotrVector &x, double beta, IotrVector &y) const
 y = beta * y + alpha * x / this if beta == 0 then y need not be initialized

virtual void diagonalDiv (double alpha, double beta, IotrVector &y) const
 y = beta * y + alpha / this if beta == 0 then y need not be initialized

virtual void copyIntoRangeFrom (int ifirst, int extent, double v[])
 Copies the elements of a traditional array.

virtual double twonorm () const
 Return the Euclidean norm of the elements.

virtual double infnorm (double addnlElt=0.0) const
 Return the Inf norm of the elements.

virtual double stepbound (const IotrVector &s, double bound) const
 Return the greatest number alpha in [0, maxstep] for which this[i] + alpha * s[i] >= 0 for all i, provided all elements of this are initially >= 0.

virtual double stepbound (const IotrVector &x, const IotrVector &xlow, ElementGather &ixlow, const IotrVector &xupp, ElementGather &ixupp, double bound) const
 Return the greatest number alpha in [0, maxstep] for which ixlow * ( this + alpha * s ) - xlow >= 0 and xupp - ixupp * ( this + alpha * s ) >= 0 Provided that these two inequalities hold for alpha = 0.

virtual IotrVectoroperator *= (const IotrVector &v)
 multiply the components of this by the components of v

virtual IotrVectoroperator/= (const IotrVector &v)
virtual void negate ()
 this := -this

virtual void makeInterior (const IotrVector &xlow, ElementGather &ixlow, const IotrVector &xupp, ElementGather &ixupp, double rtol, double atol)
 Make all elements of this interior to the bounds, leaving those already "sufficiently" interior untouched.

virtual double dot (const IotrVector &x) const
 the dot product of this with x

virtual double scaledDot (const IotrVector &D, const IotrVector &x) const
 the product this' * D * x

virtual void invertNonzero ()
 this[i] = 1/this[i] unless this[i] == 0

virtual void inspect (const char *name=0, const char *filename=0) const
 Display the elements of the vector for debugging purposes.

virtual void inspectAsMatlab (const char *name=0, const char *filename=0) const
 Display the elements of the vector, for debugging purposes, in a syntax understood by matlab.

virtual double min () const
 The minimum value in the vector.

virtual double min (const double addnElt) const
 The minimum value in the vector with addnElt adjoined.

virtual int allPositive () const
 true if all elements of this vector are positive

virtual void squareRoot ()
 replace all elements by their square root

virtual void categorize (ElementGather *cat[], int n, IotrVector *rhs[], int nrhs, const IotrVectorCategorize &func) const
 Categorize the element of this vector, possibly in relation to the elements of one or more other vectors.

virtual double sumReduce (const IotrVector *v[], int nv, const IotrVectorReduce< double > &func) const

Protected Attributes

SimpleArrayDataHandle data
 data will be used to store a vector

double * mElements
 mElements will point to the first element stored in data.


Detailed Description

A subclass of the class IotrVector that stores a dense vector and supports vector operations.


Member Function Documentation

virtual void SimpleVector::categorize ElementGather   cat[],
int    n,
IotrVector   rhs[],
int    nrhs,
const IotrVectorCategorize   func
const [virtual]
 

Categorize the element of this vector, possibly in relation to the elements of one or more other vectors.

Parameters:
cat  [output] new instances of ElementGather representing the categories.
ncat  the number of categories expected
rhs  additional vectors that may be used be the categorization rule
nrhs  the number of vectors in rhs
func  a C++ "function object" giving the categorization rule.
See also:
IotrVectorCategorize

Implements IotrVector.

virtual void SimpleVector::copyIntoRangeFrom int    ifirst,
int    extent,
double    v[]
[virtual]
 

Copies the elements of a traditional array.

The first extent elements of v are copied into data starting at mElements[ifirst]

virtual void SimpleVector::diagonalMult double    alpha,
const IotrVector   x,
double    beta,
IotrVector   y
const [virtual]
 

y = beta * y + alpha * this * x.

if beta == 0 then y need not be initialized

Implements IotrVector.

virtual double SimpleVector::infnorm double    addnlElt = 0.0 const [virtual]
 

Return the Inf norm of the elements.

Parameters:
addnlElt  an optional parameter giving an additional element\ & to adjoin to the vector before taking the infnorm

Implements IotrVector.

virtual void SimpleVector::inspect const char *    name = 0,
const char *    filename = 0
const [virtual]
 

Display the elements of the vector for debugging purposes.

Parameters:
name  the string that will be used as the name of the vector in the display. If nil, the name will be "v"
filename  the name of the file to which the display will be written. If nil, the output will be sent to stdout

Implements IotrVector.

virtual void SimpleVector::inspectAsMatlab const char *    name = 0,
const char *    filename = 0
const [virtual]
 

Display the elements of the vector, for debugging purposes, in a syntax understood by matlab.

Parameters:
name  the string that will be used as the name of the vector in the display. If nil, the name will be "v"
filename  the name of the file to which the display will be written. If nil, the output will be sent to stdout

Implements IotrVector.

virtual void SimpleVector::makeInterior const IotrVector   xlow,
ElementGather   ixlow,
const IotrVector   xupp,
ElementGather   ixupp,
double    rtol,
double    atol
[virtual]
 

Make all elements of this interior to the bounds, leaving those already "sufficiently" interior untouched.

An element of this with only a lower bound is sufficiently interior if this[i] > b + atol. Otherwise it is set to b + atol. Treatment of elements with only upper bounds is similar.

If an element has both upper and lower bounds, it is considered to be sufficiently interior if b + tol <= this[i] <= u - tol where tol = min[ atol, rtol * (u - b) ] If it is not sufficiently interior, we make the smallest change that will make the element sufficiently interior.

Implements IotrVector.

virtual double SimpleVector::min const double    addnElt const [virtual]
 

The minimum value in the vector with addnElt adjoined.

In matlab notation min([addnElt; this])

Implements IotrVector.

virtual double SimpleVector::min   [virtual]
 

The minimum value in the vector.

Will return infinity (or DBL_MAX) if the vector is empty

Implements IotrVector.

const double& SimpleVector::operator[] int    i const [inline]
 

Allows for vector[i] notation.

Return mElements[i]

double& SimpleVector::operator[] int    i [inline]
 

Allows for vector[i] notation.

Returns mElements[i]

virtual double SimpleVector::stepbound const IotrVector   x,
const IotrVector   xlow,
ElementGather   ixlow,
const IotrVector   xupp,
ElementGather   ixupp,
double    bound
const [virtual]
 

Return the greatest number alpha in [0, maxstep] for which ixlow * ( this + alpha * s ) - xlow >= 0 and xupp - ixupp * ( this + alpha * s ) >= 0 Provided that these two inequalities hold for alpha = 0.

Otherwise, the behavior is undefined.

Implements IotrVector.

virtual double SimpleVector::stepbound const IotrVector   s,
double    bound
const [virtual]
 

Return the greatest number alpha in [0, maxstep] for which this[i] + alpha * s[i] >= 0 for all i, provided all elements of this are initially >= 0.

If any element of this is negative, the behavior is undefined.

Implements IotrVector.

virtual void SimpleVector::writefToStream std::ostream &    out,
const char    format[]
const [virtual]
 

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

Parameters:
out  a C++-style output stream
format  a 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 IotrVector.


The documentation for this class was generated from the following file:
Generated on Wed Aug 27 10:03:42 2003 for iotr by doxygen1.2.18