yat  0.15.2pre
MatrixWeighted.h
1 #ifndef _theplu_yat_utility_matrix_weighted_
2 #define _theplu_yat_utility_matrix_weighted_
3 
4 // $Id: MatrixWeighted.h 3661 2017-07-14 01:10:35Z peter $
5 
6 /*
7  Copyright (C) 2003 Daniel Dalevi, Peter Johansson
8  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
10  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
11  Copyright (C) 2017 Peter Johansson
12 
13  This file is part of the yat library, http://dev.thep.lu.se/yat
14 
15  The yat library is free software; you can redistribute it and/or
16  modify it under the terms of the GNU General Public License as
17  published by the Free Software Foundation; either version 3 of the
18  License, or (at your option) any later version.
19 
20  The yat library is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with yat. If not, see <http://www.gnu.org/licenses/>.
27 */
28 
29 #include "config_public.h"
30 
31 #include "DataWeight.h"
32 #include "StrideIterator.h"
33 
34 #include <vector>
35 
36 namespace theplu {
37 namespace yat {
38 namespace utility {
39 
40  class Matrix;
41 
48  {
49  public:
54 
59 
63  typedef const DataWeight& const_reference;
64 
68  typedef std::vector<DataWeight>::iterator iterator;
69 
73  typedef std::vector<DataWeight>::const_iterator const_iterator;
74 
79 
85 
89  typedef column_iterator row_iterator;
90 
95 
101  MatrixWeighted(void);
102 
112  MatrixWeighted(size_t r, size_t c, double init_value=0,
113  double init_weight=1.0);
114 
119 
120 
121 #ifdef YAT_HAVE_RVALUE
122 
128 #endif
129 
130 
138  explicit MatrixWeighted(const Matrix& other);
139 
152  explicit MatrixWeighted(std::istream &, char sep='\0');
153 
160  iterator begin(void);
161 
168  const_iterator begin(void) const;
169 
175  column_iterator begin_column(size_t i);
176 
182  const_column_iterator begin_column(size_t i) const;
183 
189  row_iterator begin_row(size_t i);
190 
196  const_row_iterator begin_row(size_t i) const;
197 
201  size_t columns(void) const;
202 
206  iterator end(void);
207 
211  const_iterator end(void) const;
212 
216  column_iterator end_column(size_t i);
217 
221  const_column_iterator end_column(size_t i) const;
222 
226  row_iterator end_row(size_t i);
227 
231  const_row_iterator end_row(size_t i) const;
232 
242  void resize(size_t rows, size_t columns);
243 
247  size_t rows(void) const;
248 
255  void swap(MatrixWeighted& other);
256 
262  DataWeight& operator()(size_t row,size_t column);
263 
270  const DataWeight& operator()(size_t row,size_t column) const;
271 
272 
273 #ifdef YAT_HAVE_RVALUE
274 
281  MatrixWeighted& operator=(MatrixWeighted&& other);
282 #endif
283 
284  private:
285  void copy(const Matrix&);
286 
287  std::vector<DataWeight> vec_;
288  size_t columns_;
289 
290  };
291 
302 
303 }}} // of namespace utility, yat, and theplu
304 
305 #endif
void swap(MatrixWeighted &other)
swap objects
DataWeight value_type
Definition: MatrixWeighted.h:53
The Department of Theoretical Physics namespace as we define it.
void resize(size_t rows, size_t columns)
Resize MatrixWeighted.
DataWeight & reference
Definition: MatrixWeighted.h:58
row_iterator end_row(size_t i)
row_iterator begin_row(size_t i)
StrideIterator< std::vector< DataWeight >::const_iterator > const_column_iterator
Definition: MatrixWeighted.h:84
Holds a pair of data and associated weight.
Definition: DataWeight.h:39
column_iterator end_column(size_t i)
column_iterator begin_column(size_t i)
const DataWeight & const_reference
Definition: MatrixWeighted.h:63
MatrixWeighted(void)
The default constructor.
StrideIterator< std::vector< DataWeight >::iterator > column_iterator
Definition: MatrixWeighted.h:78
DataWeight & operator()(size_t row, size_t column)
Element access operator.
std::vector< DataWeight >::const_iterator const_iterator
Definition: MatrixWeighted.h:73
column_iterator row_iterator
Definition: MatrixWeighted.h:89
std::vector< DataWeight >::iterator iterator
Definition: MatrixWeighted.h:68
Interface to GSL matrix.
Definition: Matrix.h:74
Weighted Matrix.
Definition: MatrixWeighted.h:47
Adaptor using a stride on underlying iterator.
Definition: StrideIterator.h:50
const_column_iterator const_row_iterator
Definition: MatrixWeighted.h:94

Generated on Fri Jul 13 2018 02:33:27 for yat by  doxygen 1.8.11