yat  0.14.5pre
RowNormalizer.h
1 #ifndef _theplu_yat_normalizer_row_normalizer_
2 #define _theplu_yat_normalizer_row_normalizer_
3 
4 // $Id: RowNormalizer.h 3295 2014-07-25 04:24:39Z peter $
5 
6 /*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2014 Peter Johansson
9 
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11 
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16 
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 #include "yat/utility/yat_assert.h"
27 #include "yat/utility/concept_check.h"
28 
29 #include <boost/concept_check.hpp>
30 
31 #include <cstddef>
32 #include <stdexcept>
33 
34 namespace theplu {
35 namespace yat {
36 namespace normalizer {
37 
55  template<class T>
57  {
58  public:
62  typedef T normalizer_type;
63 
67  RowNormalizer(void) {}
68 
72  RowNormalizer(T norm)
73  : normalizer_(norm) {}
74 
86  template<class Container2D1, class Container2D2>
87  void operator()(const Container2D1& matrix,
88  Container2D2& result) const
89  {
90  BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
91  BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
92  using utility::yat_assert;
93  YAT_ASSERT(matrix.rows()==result.rows());
94  YAT_ASSERT(matrix.columns()==result.columns());
95  for (size_t i=0; i<matrix.rows(); ++i)
96  normalizer_(matrix.begin_row(i), matrix.end_row(i),
97  result.begin_row(i));
98  }
99 
100  private:
101  T normalizer_;
102  };
103 
104 }}} // end of namespace normalizer, yat and thep
105 #endif
RowNormalizer(void)
Default constructor.
Definition: RowNormalizer.h:67
Concept check for Container2D.
Definition: concept_check.h:59
Concept check for Mutable Container2D.
Definition: concept_check.h:125
RowNormalizer(T norm)
Constructor taking a functor norm.
Definition: RowNormalizer.h:72
T normalizer_type
Definition: RowNormalizer.h:62
Using a functor T to normalize each column.
Definition: RowNormalizer.h:56
void operator()(const Container2D1 &matrix, Container2D2 &result) const
Definition: RowNormalizer.h:87

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5