00001 #ifndef _theplu_yat_normalizer_row_normalizer_
00002 #define _theplu_yat_normalizer_rows_normalizer_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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 RowNormalizer
00057 {
00058 public:
00062 typedef T normalizer_type;
00063
00067 RowNormalizer(void) {}
00068
00072 RowNormalizer(T norm)
00073 : normalizer_(norm) {}
00074
00086 template<class Container2D1, class Container2D2>
00087 void operator()(const Container2D1& matrix,
00088 Container2D2& result) const
00089 {
00090 BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
00091 BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
00092 using utility::yat_assert;
00093 YAT_ASSERT(matrix.rows()==result.rows());
00094 YAT_ASSERT(matrix.columns()==result.columns());
00095 for (size_t i=0; i<matrix.rows(); ++i)
00096 normalizer_(matrix.begin_row(i), matrix.end_row(i),
00097 result.begin_row(i));
00098 }
00099
00100 private:
00101 T normalizer_;
00102 };
00103
00104 }}}
00105 #endif