yat  0.8.3pre
ColumnNormalizer.h
00001 #ifndef _theplu_yat_normalizer_column_normalizer_
00002 #define _theplu_yat_normalizer_column_normalizer_
00003 
00004 // $Id: ColumnNormalizer.h 2384 2010-12-22 14:03:36Z peter $
00005 
00006 /*
00007   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
00008   Copyright (C) 2009, 2010 Peter Johansson
00009 
00010   This file is part of the yat library, http://dev.thep.lu.se/yat
00011 
00012   The yat library is free software; you can redistribute it and/or
00013   modify it under the terms of the GNU General Public License as
00014   published by the Free Software Foundation; either version 3 of the
00015   License, or (at your option) any later version.
00016 
00017   The yat library is distributed in the hope that it will be useful,
00018   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00020   General Public License for more details.
00021 
00022   You should have received a copy of the GNU General Public License
00023   along with yat. If not, see <http://www.gnu.org/licenses/>.
00024 */
00025 
00026 #include "yat/utility/yat_assert.h"
00027 #include "yat/utility/concept_check.h"
00028 
00029 #include <boost/concept_check.hpp>
00030 
00031 #include <cstddef>
00032 #include <stdexcept>
00033 
00034 namespace theplu {
00035 namespace yat {
00036 namespace normalizer {
00037 
00055   template<class T>
00056   class ColumnNormalizer
00057   {
00058   public:
00062     typedef T normalizer_type;
00063 
00067     ColumnNormalizer(void) {}
00068 
00072     ColumnNormalizer(T norm) 
00073       : normalizer_(norm) {}
00074 
00086     template<class Container2D1, class Container2D2>
00087     void operator()(const Container2D1& matrix, Container2D2& result) const
00088     {
00089       BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
00090       BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
00091       YAT_ASSERT(matrix.rows()==result.rows());
00092       YAT_ASSERT(matrix.columns()==result.columns());
00093       for (size_t i=0; i<matrix.columns(); ++i)
00094         normalizer_(matrix.begin_column(i), matrix.end_column(i),
00095                     result.begin_column(i));
00096       
00097     }
00098 
00099   private:
00100     T normalizer_;
00101   };
00102 
00103 }}} // end of namespace normalizer, yat and thep
00104 #endif

Generated on Thu Dec 20 2012 03:12:57 for yat by  doxygen 1.8.0-20120409