yat  0.10.4pre
Vector.h
1 #ifndef _theplu_yat_utility_vector_
2 #define _theplu_yat_utility_vector_
3 
4 // $Id: Vector.h 2787 2012-07-23 03:14:44Z peter $
5 
6 /*
7  Copyright (C) 2003 Daniel Dalevi, Peter Johansson
8  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
10  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
11  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
12  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
13  Copyright (C) 2009, 2012 Peter Johansson
14 
15  This file is part of the yat library, http://dev.thep.lu.se/yat
16 
17  The yat library is free software; you can redistribute it and/or
18  modify it under the terms of the GNU General Public License as
19  published by the Free Software Foundation; either version 3 of the
20  License, or (at your option) any later version.
21 
22  The yat library is distributed in the hope that it will be useful,
23  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25  General Public License for more details.
26 
27  You should have received a copy of the GNU General Public License
28  along with yat. If not, see <http://www.gnu.org/licenses/>.
29 */
30 
31 #include "VectorMutable.h"
32 #include "Exception.h"
33 
34 #include <cstddef> // size_t
35 #include <iosfwd>
36 #include <stdexcept>
37 
38 #include <gsl/gsl_vector.h>
39 
40 namespace theplu {
41 namespace yat {
42 namespace utility {
43 
44  class matrix;
45 
59  class Vector : public VectorMutable
60  {
61  public:
65  Vector(void);
66 
73  explicit Vector(size_t n, double init_value=0);
74 
81  Vector(const Vector& other);
82 
89  explicit Vector(const VectorBase& other);
90 
103  explicit Vector(std::istream &, char sep='\0')
104  throw(utility::IO_error, std::exception);
105 
109  ~Vector(void);
110 
114  bool isview(void) const;
115 
126  void resize(size_t, double init_value=0);
127 
137  const Vector& operator=(const Vector&);
138 
148  const Vector& operator=(const VectorBase&);
149 
150  private:
151  const Vector& assign(const VectorBase& other);
152 
164  gsl_vector* create_gsl_vector_copy(const VectorBase&) const;
165 
177  gsl_vector* create_gsl_vector(size_t n) const;
178 
179  void delete_allocated_memory(void);
180  };
181 
191  void swap(Vector&, Vector&);
192 
193 }}} // of namespace utility, yat, and theplu
194 
195 #endif

Generated on Mon Nov 11 2013 09:41:44 for yat by  doxygen 1.8.1