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

SimpleVector.hh

Go to the documentation of this file.
00001 #ifndef SIMPLEVECTOR
00002 #define SIMPLEVECTOR
00003 
00015 #include "SimpleArrayData.hh"
00016 #include "IotrVector.hh"
00017 
00020 class SimpleVector : public IotrVector {
00021 #ifdef IOTRUNITTESTS
00022   friend class SimpleVectorTester;
00023 #endif
00024 protected:
00026   SimpleArrayDataHandle data;
00028   double * mElements;
00029 
00030   // Disable C++ value semantics
00031   SimpleVector() : IotrVector(0), data(0), mElements(0) {};
00032 public:
00034 #ifdef HAVE_EXPLICIT
00035   explicit
00036 #endif
00037   SimpleVector( int n );
00039   SimpleVector( double * v, int n );
00040   SimpleVector( SimpleVector & v, int j, int extent );
00042   double * elements()             { return mElements; }
00043   const double * elements() const { return mElements; }
00045   double & operator[]( int i ) {
00046 #if defined (CHECK_ARRAY_BOUNDS) || defined (IOTRINTENSEDEBUG)
00047     assert( i >= 0 && i < mLength );
00048 #endif
00049     return mElements[i];
00050   }
00052   const double & operator[]( int i ) const
00053   {
00054 #if defined (CHECK_ARRAY_BOUNDS) || defined (IOTRINTENSEDEBUG)
00055     assert( i >= 0 && i < mLength );
00056 #endif
00057     return mElements[i];
00058   }
00059   bool operator==( const SimpleVector& v ) const
00060   {
00061     return *data == *v.data;
00062   }
00063   bool operator!=( const SimpleVector& v ) const
00064   {
00065     return *data != *v.data;
00066   }
00067 
00068 
00069   // Specializes IotrVector::copyFrom()
00070   virtual void copyFrom( const IotrVector& v );
00071   virtual void copyFrom( const SimpleVector& v );
00072   virtual void copyInto( SimpleVector& v ) const;
00073 
00075   IotrVector * copy() const;
00076   virtual IotrVector * newSibling() const;
00077 
00078   // Specializes IotrVector::writefToStream()
00079   virtual void writefToStream( std::ostream& out,
00080                                const char format[] ) const ;
00081   // Specializes IotrVector::setToConstant()
00082   virtual void setToConstant( double c );
00083   // Specializes IotrVector::setToZero()
00084   virtual void setToZero();
00085   // Specializes IotrVector::addConstant()
00086   virtual void addConstant( double c );
00087   // Specializes IotrVector::scale()
00088   virtual void scale ( double alpha );
00089   // Specializes IotrVector::axpy()
00090   virtual void axpy  ( double alpha, const IotrVector & x );
00091   // Specializes IotrVector::axy()
00092   virtual void diagonalMult( double alpha, const IotrVector & x,
00093                              double beta, IotrVector & y ) const;
00094   virtual void diagonalDiv( double alpha, const IotrVector & x,
00095                              double beta, IotrVector & y ) const;
00096   virtual void
00097   diagonalDiv( double alpha, double beta, IotrVector & y ) const;
00101   virtual void copyIntoRangeFrom( int ifirst, int extent, double v[] );
00102   // Specializes IotrVector::twonorm()
00103   virtual double twonorm() const;
00104   // Specializes IotrVector::infnorm()
00105   virtual double infnorm( double addnlElt = 0.0 ) const;
00106   // Specializes IotrVector::stepbound()
00107   virtual double stepbound( const IotrVector& s, double bound ) const;
00108   virtual double stepbound( const IotrVector& x,
00109                             const IotrVector& xlow, ElementGather& ixlow,
00110                             const IotrVector& xupp, ElementGather& ixupp,
00111                             double bound ) const;
00112   // Specializes IotrVector:: operator*= */
00113   virtual IotrVector& operator*=( const IotrVector& v );
00114   virtual IotrVector& operator/=( const IotrVector& v );
00115   // Specializes IotrVector::negate()
00116   virtual void negate();
00117   // Specializes IotrVector::makeInterior
00118   virtual void makeInterior( const IotrVector &xlow, ElementGather & ixlow,
00119                              const IotrVector &xupp, ElementGather & ixupp,
00120                              double rtol, double atol );
00121   virtual double dot( const IotrVector &x ) const;
00122   virtual double scaledDot( const IotrVector & D,
00123                             const IotrVector & x ) const;
00124   virtual void invertNonzero();
00125   virtual void inspect( const char * name = 0,
00126                         const char * filename = 0) const;
00127   virtual void inspectAsMatlab( const char * name = 0,
00128                                 const char * filename = 0) const;
00129 
00130   virtual double min() const;
00131   virtual double min( const double addnElt ) const;
00132   virtual double sum() const;
00133   virtual int allPositive() const;
00134   virtual void squareRoot();
00135   virtual void scaleWithSqrt( const IotrVector &x );
00136   virtual void
00137   categorize( ElementGather * cat[], int n, IotrVector * rhs[], int nrhs,
00138               const IotrVectorCategorize & func ) const;
00139   virtual double sumReduce( const IotrVector * v[], int nv,
00140                             const IotrVectorReduce<double> & func ) const;
00141 };
00142 
00143 
00144 typedef Handle<SimpleVector> SimpleVectorHandle;
00145 
00150 #endif

Generated on Wed Aug 27 10:03:41 2003 for iotr by doxygen1.2.18