yat  0.10.4pre
VectorMutable.h
1 #ifndef _theplu_yat_utility_vector_mutable_
2 #define _theplu_yat_utility_vector_mutable_
3 
4 // $Id: VectorMutable.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, 2009 Jari Häkkinen, Peter Johansson
13  Copyright (C) 2012 Peter Johansson
14 
15  This file is part of the yat library, http://dev.thep.lu.se/trac/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 "VectorBase.h"
32 #include "StrideIterator.h"
33 
34 #include <gsl/gsl_vector.h>
35 
36 #include <cstddef> // size_t
37 
38 namespace theplu {
39 namespace yat {
40 namespace utility {
41 
42  class matrix;
43  class Vector;
44 
55  class VectorMutable : public VectorBase
56  {
57  public:
63  typedef double& reference;
64 
69 
73  VectorMutable(void);
74 
78  VectorMutable(gsl_vector*);
79 
83  VectorMutable(const gsl_vector*);
84 
88  virtual ~VectorMutable(void);
89 
93  void all(double value);
94 
98  iterator begin(void);
99 
100  // to allow overload from base class
101  using VectorBase::begin;
102 
109  void div(const VectorBase& other);
110 
114  iterator end(void);
115 
116  // to allow overload from base class
117  using VectorBase::end;
118 
122  gsl_vector* gsl_vector_p(void);
123 
125 
133  virtual bool isview(void) const=0;
134 
141  void mul(const VectorBase& other);
142 
146  void reverse(void);
147 
151  void swap(size_t i, size_t j);
152 
162  double& operator()(size_t i);
163 
164  // to allow overload from base class
165  using VectorBase::operator();
166 
175  const VectorMutable& operator+=(const VectorBase&);
176 
183  const VectorMutable& operator+=(double d);
184 
193  const VectorMutable& operator-=(const VectorBase&);
194 
201  const VectorMutable& operator-=(double d);
202 
209  const VectorMutable& operator*=(double d);
210 
211  protected:
218  gsl_vector* vec_;
219 
220  private:
221  // copy assignment not allowed
222  const VectorMutable& operator=(const VectorMutable&);
223 
224  };
225 
229  void shuffle(VectorMutable& invec);
230 
236  void sort(VectorMutable& vec);
237 
238 }}} // of namespace utility, yat, and theplu
239 
240 #endif

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