29  template<
typename REAL>
 
   30  class Vector : 
public std::vector<REAL>  
 
   37    static bool bScientific;
 
   38    static std::size_t nIndexWidth;
 
   39    static std::size_t nValueWidth;
 
   40    static std::size_t nValuePrecision;
 
   58    Vector (
const std::initializer_list<REAL> &
v)
 
 
   88      const size_t s = this->size();
 
   90      for(
size_t i=0; 
i<s; ++
i)
 
 
  162      for (
size_t i = 0; 
i < this->size(); ++
i)
 
 
  172      for (
size_t i = 0; 
i < this->size(); ++
i)
 
 
  181      assert( this->size() == 
y.size());
 
  183      for (
size_t i = 0; 
i < this->size(); ++
i)
 
 
  192      assert( this->size() == 
y.size());
 
  194      for (
size_t i = 0; 
i < this->size(); ++
i)
 
 
  203      assert( this->size() == 
y.size());
 
  205      for (
size_t i = 0; 
i < this->size(); ++
i)
 
 
  247      for( 
size_t i = 0; 
i < this->size(); ++
i )
 
 
  344      for (
size_t i = 0; 
i < (
size_t) this->size(); ++
i)
 
 
  431      return nValuePrecision;
 
 
 
  456  template<
typename REAL>
 
  457  bool Vector<REAL>::bScientific = 
true;
 
  459  template<
typename REAL>
 
  460  std::size_t Vector<REAL>::nIndexWidth = 2;
 
  462  template<
typename REAL>
 
  463  std::size_t Vector<REAL>::nValueWidth = 15;
 
  465  template<
typename REAL>
 
  466  std::size_t Vector<REAL>::nValuePrecision = 7;
 
  490  template <
typename REAL>
 
  495    for (
size_t r = 0; 
r < x.size(); ++
r)
 
  505               << std::setw( x.
width() )
 
  518               << std::setw( x.
width() )
 
 
  551  template<
typename REAL>
 
  553                      const std::string& 
fname,
 
  557    std::fstream f(
fname.c_str(),std::ios::out);
 
  562            f << std::setw(x.
width())
 
  566              << std::setw( x.
width() )
 
  573            f << std::setw(x.
width())
 
  577              << std::setw( x.
width() )
 
 
  586  template<
typename REAL>
 
  588                      const std::string& 
fname,
 
  589                      const std::vector<std::string>& t,
 
  593    std::fstream f(
fname.c_str(),std::ios::out);
 
  601              << std::setw( x.
width() )
 
  611              << std::setw( x.
width() )
 
  621  template<
typename REAL>
 
  623                      const std::string& fname,
 
  624                      const Vector<REAL> x,
 
  628    std::fstream f(fname.c_str(),std::ios::out);
 
  633            f << std::setw(x.width())
 
  637              << std::setw( x.width() )
 
  638              << std::setprecision( x.precision() )
 
  641              << std::setw( x.width() )
 
  642              << std::setprecision( x.precision() )
 
  648            f << std::setw(x.width())
 
  652              << std::setw( x.width() )
 
  653              << std::setprecision( x.precision() )
 
  656              << std::setw( x.width() )
 
  657              << std::setprecision( x.precision() )
 
  696  template<
typename REAL>
 
  706        if( sub.length()>0 ){
 
  715      HDNUM_ERROR(
"Could not open file!");
 
 
  730  inline REAL norm (Vector<REAL> x)
 
  740  inline void fill (Vector<REAL>& x, 
const REAL t)
 
Class with mathematical matrix operations.
Definition densematrix.hh:33
 
std::size_t iwidth() const
get index field width for pretty-printing
Definition densematrix.hh:182
 
std::size_t precision() const
get data precision for pretty-printing
Definition densematrix.hh:188
 
std::size_t width() const
get data field width for pretty-printing
Definition densematrix.hh:185
 
Class with mathematical vector operations.
Definition vector.hh:31
 
void precision(std::size_t i) const
set data precision for pretty-printing
Definition vector.hh:447
 
std::size_t size_type
Type used for array indices.
Definition vector.hh:34
 
Vector(const size_t size, const REAL defaultvalue_=0)
another constructor, with arguments, setting the default value for all entries of the vector of given...
Definition vector.hh:50
 
REAL operator*(Vector &x) const
Inner product with another vector.
Definition vector.hh:242
 
Vector & operator/=(const REAL value)
Division by a scalar value (x /= value)
Definition vector.hh:169
 
void fill(Vector< REAL > &x, const REAL &t, const REAL &dt)
Fill vector, with entries starting at t, consecutively shifted by dt.
Definition vector.hh:769
 
std::size_t width() const
get data field width for pretty-printing
Definition vector.hh:423
 
void scientific(bool b) const
scientific(true) is the default, scientific(false) switches to the fixed point representation
Definition vector.hh:411
 
Vector sub(size_type i, size_type m)
Subvector extraction.
Definition vector.hh:104
 
void unitvector(Vector< REAL > &x, std::size_t j)
Defines j-th unitvector (j=0,...,n-1) where n = length of the vector.
Definition vector.hh:803
 
Vector & operator+=(const Vector &y)
Add another vector (x += y)
Definition vector.hh:179
 
Vector()
default constructor, also inherited from the STL vector default constructor
Definition vector.hh:45
 
std::size_t precision() const
get data precision for pretty-printing
Definition vector.hh:429
 
bool scientific() const
pretty-print output property: true = scientific, false = fixed point representation
Definition vector.hh:379
 
std::size_t iwidth() const
get index field width for pretty-printing
Definition vector.hh:417
 
Vector operator-(Vector &x) const
vector subtraction x-y
Definition vector.hh:329
 
REAL two_norm_2() const
Square of the Euclidean norm.
Definition vector.hh:340
 
Vector(const std::initializer_list< REAL > &v)
constructor from initializer list
Definition vector.hh:58
 
Vector & update(const REAL alpha, const Vector &y)
Update vector by addition of a scaled vector (x += a y )
Definition vector.hh:201
 
Vector & operator-=(const Vector &y)
Subtract another vector (x -= y)
Definition vector.hh:190
 
Vector & operator*=(const REAL value)
Multiplication by a scalar value (x *= value)
Definition vector.hh:159
 
Vector & operator=(const REAL value)
Assign all values of the Vector from one scalar value: x = value.
Definition vector.hh:86
 
Vector operator+(Vector &x) const
Adding two vectors x+y.
Definition vector.hh:287
 
void gnuplot(const std::string &fname, const Vector< REAL > x)
Output contents of a Vector x to a text file named fname.
Definition vector.hh:552
 
void readVectorFromFile(const std::string &filename, Vector< REAL > &vector)
Read vector from a text file.
Definition vector.hh:697
 
void width(std::size_t i) const
set data field width for pretty-printing
Definition vector.hh:441
 
REAL two_norm() const
Euclidean norm of a vector.
Definition vector.hh:373
 
void iwidth(std::size_t i) const
set index field width for pretty-printing
Definition vector.hh:435
 
A few common exception classes.