Epetra_SerialDenseVector.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_SERIALDENSEVECTOR_H
00033 #define EPETRA_SERIALDENSEVECTOR_H
00034 
00035 #include "Epetra_Object.h" 
00036 #include "Epetra_SerialDenseMatrix.h"
00037 
00039 
00082 //=========================================================================
00083 class Epetra_SerialDenseVector : public Epetra_SerialDenseMatrix{
00084 
00085   public:
00086   
00088 
00089 
00090 
00095   Epetra_SerialDenseVector();
00096   
00098 
00107   Epetra_SerialDenseVector(int Length);
00108 
00110 
00120   Epetra_SerialDenseVector(Epetra_DataAccess CV, double* Values, int Length);
00121   
00123   
00124   Epetra_SerialDenseVector(const Epetra_SerialDenseVector& Source);
00125   
00126 
00128   virtual ~Epetra_SerialDenseVector ();
00130 
00132 
00133 
00135 
00145   int Size(int Length_in) {return(Epetra_SerialDenseMatrix::Shape(Length_in, 1));};
00146   
00148 
00159   int Resize(int Length_in) {return(Epetra_SerialDenseMatrix::Reshape(Length_in, 1));};
00160 
00162 
00164 
00165 
00166 
00172     Epetra_SerialDenseVector& operator = (const Epetra_SerialDenseVector& Source);
00173 
00174     //let the compiler know we intend to overload the base-class function
00175     //operator() rather than hide it.
00176     using Epetra_SerialDenseMatrix::operator();
00177 
00179 
00185     double& operator () (int Index);
00186 
00188 
00194     const double& operator () (int Index) const;
00195 
00197 
00203     double& operator [] (int Index);
00204 
00206 
00212     const double& operator [] (int Index) const;
00213 
00215 
00217 
00218 
00219 
00225   int Random();
00226     
00228 
00233   double Dot(const Epetra_SerialDenseVector & x) const;
00234 
00236 
00239   double Norm1() const;
00240 
00242 
00246   double Norm2() const;
00247 
00249 
00252   double NormInf() const;
00253 
00255 
00257 
00258 
00259   int Length() const {return(M_);};
00260 
00262   double* Values() const {return(A_);};
00263 
00265   Epetra_DataAccess CV() const {return(CV_);};
00266 
00268 
00270 
00271 
00272   virtual void Print(ostream& os) const;
00274 };
00275 
00276 // inlined definitions of op() and op[]
00277 //=========================================================================
00278 inline double& Epetra_SerialDenseVector::operator() (int Index)  {
00279 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00280   if (Index >= M_ || Index < 0) 
00281     throw ReportError("Index = " +toString(Index) + " Out of Range 0 - " + toString(M_-1), -1);
00282 #endif
00283   return(A_[Index]);
00284 }
00285 //=========================================================================
00286 inline const double& Epetra_SerialDenseVector::operator() (int Index) const  {
00287 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00288   if (Index >= M_ || Index < 0) 
00289     throw ReportError("Index = " +toString(Index) + " Out of Range 0 - " + toString(M_-1), -1);
00290 #endif
00291    return(A_[Index]);
00292 }
00293 //=========================================================================
00294 inline double& Epetra_SerialDenseVector::operator [] (int Index)  {
00295 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00296   if (Index >= M_ || Index < 0) 
00297     throw ReportError("Index = " +toString(Index) + " Out of Range 0 - " + toString(M_-1), -1);
00298 #endif
00299    return(A_[Index]);
00300 }
00301 //=========================================================================
00302 inline const double& Epetra_SerialDenseVector::operator [] (int Index) const  {
00303 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00304   if (Index >= M_ || Index < 0) 
00305     throw ReportError("Index = " +toString(Index) + " Out of Range 0 - " + toString(M_-1), -1);
00306 #endif
00307    return(A_[Index]);
00308 }
00309 //=========================================================================
00310 
00311 #endif /* EPETRA_SERIALDENSEVECTOR_H */

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7