00001 #ifndef _theplu_yat_normalizer_column_normalizer_
00002 #define _theplu_yat_normalizer_column_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
00028 #include <cstddef>
00029 #include <stdexcept>
00030
00031 namespace theplu {
00032 namespace yat {
00033 namespace normalizer {
00034
00052 template<class T>
00053 class ColumnNormalizer
00054 {
00055 public:
00059 typedef T normalizer_type;
00060
00064 ColumnNormalizer(void) {}
00065
00069 ColumnNormalizer(T norm)
00070 : normalizer_(norm) {}
00071
00083 template<class Container2D1, class Container2D2>
00084 void operator()(const Container2D1& matrix, Container2D2& result) const
00085 {
00086 using utility::yat_assert;
00087 yat_assert<std::runtime_error>(matrix.rows()==result.rows(),
00088 "ColumnNormalizer: rows mismatch");
00089 yat_assert<std::runtime_error>(matrix.columns()==result.columns(),
00090 "ColumnNormalizer: columns mismatch");
00091 for (size_t i=0; i<matrix.columns(); ++i)
00092 normalizer_(matrix.begin_column(i), matrix.end_column(i),
00093 result.begin_column(i));
00094
00095 }
00096
00097 private:
00098 T normalizer_;
00099 };
00100
00101 }}}
00102 #endif