Sandia Home Sandia Home
Main Page | Publications | Downloads | Configuration | Running the Code | Solver Parameters | FAQ | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

APPSPACK::Vector Class Reference

#include <APPSPACK_Vector.hpp>

List of all members.


Detailed Description

Class Vector -- Extends properties of the Standard Template Library (STL) vector<double>, v.

Definition at line 47 of file APPSPACK_Vector.hpp.

Public Member Functions

 Vector ()
 Constructor -- creates vector of length 0.
 Vector (int n)
 Constructor -- creates vector of length n.
 Vector (int n, double val)
 Constructor -- creates vector of length n, each element assigned the value val.
 Vector (int n, double *x)
 Constructor -- creates a vector by copying the first n elements pointed by x.
 Vector (const Vector &x)
 Copy constructor.
 Vector (const vector< double > &x)
 Copy constructor.
 ~Vector ()
 Destructor.
Memory allocating/altering methods.
void resize (int n)
 Resizes vector length.
void reserve (int n)
 Sets the capacity of the vector to at least n.
void push_back (double a)
 Appends a to the end of the vector, increasing vector length by 1.
void assign (int n, double alpha)
 Reset vector to size n and all values to value alpha.
void append (const Vector &x)
 Appends x to end of the vector.
void append (int n, double alpha)
 Appends n copies of alpha to the end of the vector.
void erase (int i)
 Deletes the ith element from the vector, decreasing the length by 1.
Vectoroperator= (const Vector &x)
 Copies x.
Data access methods.
int size () const
 Returns the length of the vector.
bool empty () const
 Return true if vector is size zero, false otherwise.
const vector< double > & getStlVector () const
 Returns an equivalent STL vector.
double operator[] (int i) const
 Returns the ith element of the vector.
bool operator== (const Vector &x) const
 Returns true if two vectors are equal, false otherwise.
bool operator!= (const Vector &x) const
 Returns true if two vectors are not equal, false otherwise.
void copyToBool (vector< bool > &b) const
 On exit, b[i] = true if the ith element of the vector is nonzero, false otherwise.
ostream & leftshift (ostream &stream) const
 Prints out vector to specified stream.
ostream & leftshift (ostream &stream, int precision) const
 Prints out vector to specified stream.
Vector mathematics.
void zero ()
 Sets all entries of the vector to zero.
void scale (double alpha)
 Scales all elements of the vector by scalar alpha.
void scale (const Vector &s)
 On exit, the ith element is scaled by s[i].
double norm () const
 Returns the two norm of the vector.
double min () const
 Returns the smallest element of the vector.
double max () const
 Returns the largest element of the vector.
double dot (const Vector &x) const
 Compute the dot product between v (this vector) and x.
Vectoroperator+= (const Vector &x)
 Adds x to this vector.
Vectoroperator-= (const Vector &x)
 Substracts x from this vector.
double & operator[] (int i)
 Returns a reference to the ith element.

Private Attributes

vector< double > vec
 The vector.


Constructor & Destructor Documentation

APPSPACK::Vector::Vector  ) 
 

Constructor -- creates vector of length 0.

Definition at line 43 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::Vector int  n  ) 
 

Constructor -- creates vector of length n.

Definition at line 47 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::Vector int  n,
double  val
 

Constructor -- creates vector of length n, each element assigned the value val.

Definition at line 51 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::Vector int  n,
double *  x
 

Constructor -- creates a vector by copying the first n elements pointed by x.

Definition at line 55 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::Vector const Vector x  ) 
 

Copy constructor.

Definition at line 59 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::Vector const vector< double > &  x  ) 
 

Copy constructor.

Definition at line 63 of file APPSPACK_Vector.cpp.

APPSPACK::Vector::~Vector  ) 
 

Destructor.

Definition at line 67 of file APPSPACK_Vector.cpp.


Member Function Documentation

void APPSPACK::Vector::resize int  n  ) 
 

Resizes vector length.

Definition at line 71 of file APPSPACK_Vector.cpp.

References vec.

Referenced by copyToBool(), APPSPACK::Matrix::copyToFortranVector(), APPSPACK::Constraints::Linear::formDistanceVector(), APPSPACK::Constraints::Linear::formSnapSystem(), APPSPACK::Solver::generateTrialPoints(), APPSPACK::Directions::getDirectionIndices(), APPSPACK::Constraints::Linear::getNominalX(), CustomEvaluator::operator()(), APPSPACK::Cache::Manager::processInputLine(), APPSPACK::processTextInputFileLine(), APPSPACK::Evaluator::SystemCall::readOutputFile(), CustomExecutor::recv(), APPSPACK::Matrix::resize(), APPSPACK::Constraints::Linear::setupScaledSystem(), APPSPACK::Matrix::svd(), and APPSPACK::GCI::unpack().

void APPSPACK::Vector::reserve int  n  ) 
 

Sets the capacity of the vector to at least n.

Definition at line 76 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Matrix::copyToFortranVector().

void APPSPACK::Vector::push_back double  a  ) 
 

Appends a to the end of the vector, increasing vector length by 1.

Definition at line 81 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Matrix::addRow(), APPSPACK::Matrix::copyToFortranVector(), APPSPACK::Constraints::Linear::formSnapSystem(), APPSPACK::Directions::getDirectionIndices(), APPSPACK::Matrix::getRowPointers(), APPSPACK::Cache::Manager::processInputLine(), APPSPACK::Evaluator::SystemCall::readOutputFile(), APPSPACK::Constraints::Linear::setupScaledSystem(), and APPSPACK::Constraints::Linear::setupScaling().

void APPSPACK::Vector::assign int  n,
double  alpha
 

Reset vector to size n and all values to value alpha.

Definition at line 86 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Constraints::Linear::setupBounds(), APPSPACK::Constraints::Linear::setupRhs(), APPSPACK::Directions::updateDirectionInfo(), and zero().

void APPSPACK::Vector::append const Vector x  ) 
 

Appends x to end of the vector.

Definition at line 91 of file APPSPACK_Vector.cpp.

References size(), and vec.

Referenced by APPSPACK::Matrix::copyToFortranVector(), and APPSPACK::Directions::updateDirectionInfo().

void APPSPACK::Vector::append int  n,
double  alpha
 

Appends n copies of alpha to the end of the vector.

Definition at line 97 of file APPSPACK_Vector.cpp.

References vec.

void APPSPACK::Vector::erase int  i  ) 
 

Deletes the ith element from the vector, decreasing the length by 1.

Definition at line 102 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Matrix::deleteRow(), APPSPACK::Constraints::Linear::formSnapSystem(), and APPSPACK::Matrix::pruneDependentRows().

APPSPACK::Vector & APPSPACK::Vector::operator= const Vector x  ) 
 

Copies x.

Definition at line 107 of file APPSPACK_Vector.cpp.

References vec.

int APPSPACK::Vector::size  )  const
 

Returns the length of the vector.

Definition at line 113 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Matrix::addRow(), append(), APPSPACK::Directions::buildWithCddlib(), APPSPACK::Cache::Point::checkSize(), CustomEvaluator::constraint(), dot(), APPSPACK::Constraints::Linear::errorCheck(), CustomEvaluator::feval(), APPSPACK::Constraints::Linear::formSnapSystem(), APPSPACK::Solver::generateTrialPoints(), APPSPACK::Constraints::Linear::getNominalX(), APPSPACK::Matrix::getRighInvAndNullBasis(), APPSPACK::Directions::getSmallestStep(), APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Constraints::Linear::isFeasible(), APPSPACK::Constraints::Linear::makeBoundsFeasible(), APPSPACK::Constraints::Linear::maxStep(), APPSPACK::Matrix::multVec(), APPSPACK::Matrix::nullSpace(), APPSPACK::Cache::Point::operator!=(), APPSPACK::Combiner::Generic::operator()(), operator+=(), operator-=(), APPSPACK::Cache::Point::operator<(), APPSPACK::Cache::Point::operator>(), APPSPACK::GCI::pack(), APPSPACK::Constraints::Linear::print(), APPSPACK::Evaluator::SystemCall::readOutputFile(), scale(), APPSPACK::Constraints::Linear::scale(), APPSPACK::Constraints::Linear::setupBounds(), APPSPACK::Constraints::Linear::setupMatrix(), APPSPACK::Constraints::Linear::setupRhs(), APPSPACK::Constraints::Linear::setupScaledSystem(), APPSPACK::Constraints::Linear::setupScaling(), APPSPACK::Constraints::Linear::unscale(), and APPSPACK::Evaluator::SystemCall::writeInputFile().

bool APPSPACK::Vector::empty  )  const
 

Return true if vector is size zero, false otherwise.

Definition at line 118 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Constraints::Linear::setupBounds(), and APPSPACK::Constraints::Linear::setupScaling().

const vector< double > & APPSPACK::Vector::getStlVector  )  const
 

Returns an equivalent STL vector.

Definition at line 123 of file APPSPACK_Vector.cpp.

Referenced by APPSPACK::Solver::getBestVecF(), and APPSPACK::Solver::getBestX().

double APPSPACK::Vector::operator[] int  i  )  const
 

Returns the ith element of the vector.

Definition at line 128 of file APPSPACK_Vector.cpp.

References vec.

bool APPSPACK::Vector::operator== const Vector x  )  const
 

Returns true if two vectors are equal, false otherwise.

Definition at line 133 of file APPSPACK_Vector.cpp.

References vec.

bool APPSPACK::Vector::operator!= const Vector x  )  const
 

Returns true if two vectors are not equal, false otherwise.

Definition at line 138 of file APPSPACK_Vector.cpp.

References vec.

void APPSPACK::Vector::copyToBool vector< bool > &  b  )  const
 

On exit, b[i] = true if the ith element of the vector is nonzero, false otherwise.

b is automatically resized to have appropriate length.

Definition at line 143 of file APPSPACK_Vector.cpp.

References resize(), and vec.

Referenced by APPSPACK::Constraints::Linear::setupBounds().

ostream & APPSPACK::Vector::leftshift ostream &  stream  )  const
 

Prints out vector to specified stream.

Definition at line 150 of file APPSPACK_Vector.cpp.

References APPSPACK::Print::formatDouble(), and vec.

Referenced by operator<<(), and APPSPACK::Cache::Manager::writeToOutputFile().

ostream & APPSPACK::Vector::leftshift ostream &  stream,
int  precision
const
 

Prints out vector to specified stream.

Definition at line 159 of file APPSPACK_Vector.cpp.

References APPSPACK::Print::formatDouble(), and vec.

void APPSPACK::Vector::zero  ) 
 

Sets all entries of the vector to zero.

Definition at line 176 of file APPSPACK_Vector.cpp.

References assign(), and vec.

Referenced by APPSPACK::Matrix::multVecWithoutBlas(), and APPSPACK::Matrix::setToIdentity().

void APPSPACK::Vector::scale double  alpha  ) 
 

Scales all elements of the vector by scalar alpha.

Definition at line 181 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Matrix::addMatrix(), APPSPACK::Matrix::addRow(), and APPSPACK::Matrix::normalize().

void APPSPACK::Vector::scale const Vector s  ) 
 

On exit, the ith element is scaled by s[i].

Definition at line 187 of file APPSPACK_Vector.cpp.

References size(), and vec.

double APPSPACK::Vector::norm  )  const
 

Returns the two norm of the vector.

Definition at line 199 of file APPSPACK_Vector.cpp.

References norm(), and vec.

Referenced by APPSPACK::Matrix::addUniqueRows(), APPSPACK::Constraints::Linear::getEqState(), norm(), APPSPACK::Matrix::normalize(), and APPSPACK::Constraints::Linear::setupScaledSystem().

double APPSPACK::Vector::min  )  const
 

Returns the smallest element of the vector.

Definition at line 207 of file APPSPACK_Vector.cpp.

References vec.

double APPSPACK::Vector::max  )  const
 

Returns the largest element of the vector.

Definition at line 221 of file APPSPACK_Vector.cpp.

References vec.

Referenced by APPSPACK::Directions::getSmallestStep().

double APPSPACK::Vector::dot const Vector x  )  const
 

Compute the dot product between v (this vector) and x.

Definition at line 235 of file APPSPACK_Vector.cpp.

References APPSPACK::DDOT_F77(), size(), and vec.

Referenced by APPSPACK::Constraints::Linear::getEqState(), and APPSPACK::Constraints::Linear::getIneqState().

APPSPACK::Vector & APPSPACK::Vector::operator+= const Vector x  ) 
 

Adds x to this vector.

Definition at line 260 of file APPSPACK_Vector.cpp.

References size(), and vec.

APPSPACK::Vector & APPSPACK::Vector::operator-= const Vector x  ) 
 

Substracts x from this vector.

Definition at line 274 of file APPSPACK_Vector.cpp.

References size(), and vec.

double & APPSPACK::Vector::operator[] int  i  ) 
 

Returns a reference to the ith element.

Definition at line 288 of file APPSPACK_Vector.cpp.

References vec.


Member Data Documentation

vector<double> APPSPACK::Vector::vec [private]
 

The vector.

Definition at line 169 of file APPSPACK_Vector.hpp.

Referenced by append(), assign(), copyToBool(), dot(), empty(), erase(), leftshift(), max(), min(), norm(), operator!=(), operator+=(), operator-=(), operator=(), operator==(), operator[](), push_back(), reserve(), resize(), scale(), size(), and zero().


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

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Fri Feb 16 10:33:36 2007 for APPSPACK 5.0.1 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2002