程序代写 tnt_vec.h Source File

tnt_vec.h Source File

Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Copyright By PowCoder代写 加微信 powcoder

Go to the documentation of this file.00001 /*
00003 * Template Numerical Toolkit (TNT)
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00022 #ifndef TNT_VEC_H
00023 #define TNT_VEC_H
00025 #include “tnt_subscript.h”
00026 #include
00027 #include
00028 #include
00029 #include
00031 namespace TNT
00041 template
00042 class Vector
00046 public:
00048 typedef Subscript size_type;
00049 typedef T value_type;
00050 typedef T element_type;
00051 typedef T* pointer;
00052 typedef T* iterator;
00053 typedef T& reference;
00054 typedef const T* const_iterator;
00055 typedef const T& const_reference;
00057 Subscript lbound() const { return 1;}
00061 public:
00063 // access
00065 iterator begin() { return v_;}
00066 iterator end() { return v_ + n_; }
00067 const iterator begin() const { return v_;}
00068 const iterator end() const { return v_ + n_; }
00070 // destructor
00072 ~Vector() ;
00074 // constructors
00076 Vector();
00078 Vector(const Vector &A);
00080 Vector(Subscript N, const T& value = T()) : v_(0), vm1_(0), n_(0);
00082 Vector(Subscript N, const T* v) : v_(0), vm1_(0), n_(0);
00084 Vector(Subscript N, char *s) : v_(0), vm1_(0), n_(0);
00086 Vector& newsize(Subscript N);
00089 Vector& operator=(const Vector &A);
00090 Vector& operator=(const T& scalar);
00092 inline Subscript dim() const ;
00094 inline Subscript size() const ;
00097 inline reference operator()(Subscript i);
00099 inline const_reference operator() (Subscript i) const;
00101 inline reference operator[](Subscript i);
00103 inline const_reference operator[](Subscript i) const;
00110 /* *************************** I/O ********************************/
00112 template
00113 std::ostream& operator<<(std::ostream &s, const Vector &A);
00115 template
00116 std::istream & operator>>(std::istream &s, Vector &A);
00118 // *******************[ basic matrix algorithms ]***************************
00121 template
00122 Vector operator+(const Vector &A, const Vector &B);
00124 template
00125 Vector operator-(const Vector &A, const Vector &B);
00128 template
00129 Vector operator*(const Vector &A, const Vector &B);
00132 template
00133 T dot_prod(const Vector &A, const Vector &B);
00135 } /* namespace TNT */
00137 #endif
00138 // TNT_VEC_H

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by

1.2.5 written by Dimitri van Heesch,
© 1997-2001

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com