yat  0.14.5pre
ColumnNormalizer.h
1 #ifndef _theplu_yat_normalizer_column_normalizer_
2 #define _theplu_yat_normalizer_column_normalizer_
3 
4 // $Id: ColumnNormalizer.h 3330 2014-10-14 08:03:25Z 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 
68 
73  : normalizer_(norm) {}
74 
86  template<class Container2D1, class Container2D2>
87  void operator()(const Container2D1& matrix, Container2D2& result) const
88  {
89  BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
90  BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
91  YAT_ASSERT(matrix.rows()==result.rows());
92  YAT_ASSERT(matrix.columns()==result.columns());
93  for (size_t i=0; i<matrix.columns(); ++i)
94  normalizer_(matrix.begin_column(i), matrix.end_column(i),
95  result.begin_column(i));
96  }
97 
98  private:
99  T normalizer_;
100  };
101 
102 }}} // end of namespace normalizer, yat and thep
103 #endif
Concept check for Container2D.
Definition: concept_check.h:59
void operator()(const Container2D1 &matrix, Container2D2 &result) const
Definition: ColumnNormalizer.h:87
Concept check for Mutable Container2D.
Definition: concept_check.h:125
ColumnNormalizer(void)
Default constructor.
Definition: ColumnNormalizer.h:67
T normalizer_type
Definition: ColumnNormalizer.h:62
ColumnNormalizer(T norm)
Constructor taking a functor norm.
Definition: ColumnNormalizer.h:72
Using a functor T to normalize each column.
Definition: ColumnNormalizer.h:56

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