yat  0.18.2pre
MatrixWeighted.h
1 #ifndef _theplu_yat_utility_matrix_weighted_
2 #define _theplu_yat_utility_matrix_weighted_
3 
4 // $Id: MatrixWeighted.h 3938 2020-07-16 13:16:56Z 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 
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 
127 
128 
136  explicit MatrixWeighted(const Matrix& other);
137 
150  explicit MatrixWeighted(std::istream &, char sep='\0');
151 
158  iterator begin(void);
159 
166  const_iterator begin(void) const;
167 
173  column_iterator begin_column(size_t i);
174 
180  const_column_iterator begin_column(size_t i) const;
181 
187  row_iterator begin_row(size_t i);
188 
194  const_row_iterator begin_row(size_t i) const;
195 
199  size_t columns(void) const;
200 
204  iterator end(void);
205 
209  const_iterator end(void) const;
210 
214  column_iterator end_column(size_t i);
215 
219  const_column_iterator end_column(size_t i) const;
220 
224  row_iterator end_row(size_t i);
225 
229  const_row_iterator end_row(size_t i) const;
230 
240  void resize(size_t rows, size_t columns);
241 
245  size_t rows(void) const;
246 
253  void swap(MatrixWeighted& other);
254 
260  DataWeight& operator()(size_t row,size_t column);
261 
268  const DataWeight& operator()(size_t row,size_t column) const;
269 
270 
279 
280  private:
281  void copy(const Matrix&);
282 
283  std::vector<DataWeight> vec_;
284  size_t columns_;
285 
286  };
287 
297  void swap(MatrixWeighted&, MatrixWeighted&);
298 
299 }}} // of namespace utility, yat, and theplu
300 
301 #endif
void swap(MatrixWeighted &other)
swap objects
DataWeight value_type
Definition: MatrixWeighted.h:53
MatrixWeighted & operator=(MatrixWeighted &&other)
The move assignment operator.
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 Tue Sep 7 2021 17:32:33 for yat by  doxygen 1.8.14