yat  0.21pre
MatrixWeighted.h
1 #ifndef _theplu_yat_utility_matrix_weighted_
2 #define _theplu_yat_utility_matrix_weighted_
3 
4 // $Id: MatrixWeighted.h 4207 2022-08-26 04:36:28Z 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, 2022 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 MatrixBase;
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 MatrixBase& other);
137 
151  explicit MatrixWeighted(std::istream &, char sep='\0');
152 
159  iterator begin(void);
160 
167  const_iterator begin(void) const;
168 
174  column_iterator begin_column(size_t i);
175 
181  const_column_iterator begin_column(size_t i) const;
182 
188  row_iterator begin_row(size_t i);
189 
195  const_row_iterator begin_row(size_t i) const;
196 
200  size_t columns(void) const;
201 
205  iterator end(void);
206 
210  const_iterator end(void) const;
211 
215  column_iterator end_column(size_t i);
216 
220  const_column_iterator end_column(size_t i) const;
221 
225  row_iterator end_row(size_t i);
226 
230  const_row_iterator end_row(size_t i) const;
231 
241  void resize(size_t rows, size_t columns);
242 
246  size_t rows(void) const;
247 
254  void swap(MatrixWeighted& other);
255 
261  DataWeight& operator()(size_t row,size_t column);
262 
269  const DataWeight& operator()(size_t row,size_t column) const;
270 
271 
280 
281  private:
282  void copy(const MatrixBase&);
283 
284  std::vector<DataWeight> vec_;
285  size_t columns_;
286 
287  };
288 
298  void swap(MatrixWeighted&, MatrixWeighted&);
299 
300 }}} // of namespace utility, yat, and theplu
301 
302 #endif
Definition: MatrixBase.h:54
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
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 Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14