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.hpp

Go to the documentation of this file.
00001 // $Id: APPSPACK_Vector.hpp,v 1.32 2006/06/30 01:42:08 tgkolda Exp $ 
00002 // $Source: /space/CVS-Acro/acro/packages/appspack/appspack/src/APPSPACK_Vector.hpp,v $ 
00003 
00004 //@HEADER
00005 // ************************************************************************
00006 // 
00007 //          APPSPACK: Asynchronous Parallel Pattern Search
00008 //                 Copyright (2003) Sandia Corporation
00009 // 
00010 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00011 // license for use of this work by or on behalf of the U.S. Government.
00012 // 
00013 // This library is free software; you can redistribute it and/or modify
00014 // it under the terms of the GNU Lesser General Public License as
00015 // published by the Free Software Foundation; either version 2.1 of the
00016 // License, or (at your option) any later version.
00017 //  
00018 // This library is distributed in the hope that it will be useful, but
00019 // WITHOUT ANY WARRANTY; without even the implied warranty of
00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021 // Lesser General Public License for more details.
00022 //                                                                                 
00023 // You should have received a copy of the GNU Lesser General Public
00024 // License along with this library; if not, write to the Free Software
00025 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00026 // USA.                                                                           .
00027 // 
00028 // Questions? Contact Tammy Kolda (tgkolda@sandia.gov) 
00029 // 
00030 // ************************************************************************
00031 //@HEADER
00032 
00038 #ifndef APPSPACK_VECTOR_HPP
00039 #define APPSPACK_VECTOR_HPP
00040 
00041 #include "APPSPACK_Common.hpp"
00042 
00043 namespace APPSPACK
00044 {
00045 
00047 class Vector
00048 {
00049 
00050 public:
00051 
00053   Vector();
00054 
00056   Vector(int n);
00057 
00059   Vector(int n, double val);
00060 
00062   Vector(int n, double *x);
00063 
00065   Vector(const Vector& x);
00066   
00068   Vector(const vector<double>& x);
00069   
00071   ~Vector();
00072 
00074 
00076   void resize(int n);
00077   
00079   void reserve(int n);
00080 
00082   void push_back(double a);
00083   
00085   void assign(int n, double alpha);
00086   
00088   void append(const Vector& x);
00089 
00091   void append(int n, double alpha);
00092 
00094   void erase(int i);
00095 
00097   Vector& operator=(const Vector& x);  
00098 
00100 
00102 
00103   int size() const;
00104 
00106   bool empty() const;
00107 
00109   const vector<double>& getStlVector() const;
00110  
00112   double operator[](int i) const;
00113   
00115   bool operator==(const Vector& x) const;
00116 
00118   bool operator!=(const Vector& x) const;
00119 
00121 
00122   void copyToBool(vector<bool>& b) const;
00123 
00125   ostream& leftshift(ostream& stream) const;
00126 
00128   ostream& leftshift(ostream& stream, int precision) const;
00129 
00131 
00133 
00135   void zero();
00136 
00138   void scale(double alpha);  
00139   
00141   void scale(const Vector& s);  
00142     
00144   double norm() const;
00145 
00147   double min() const;
00148 
00150   double max() const;
00151 
00153   double dot(const Vector& x) const;
00154   
00156   Vector& operator+=(const Vector& x);
00157   
00159   Vector& operator-=(const Vector& x);
00160 
00162   double& operator[](int i);
00163 
00165 
00166 private:
00167   
00169   vector<double> vec;
00170 
00171 };
00172 
00173 }
00174 
00176 ostream& operator<<(ostream& stream, const APPSPACK::Vector& x);
00177 
00178 #endif

 

© Sandia Corporation | Site Contact | Privacy and Security

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