yat
0.8.3pre
|
00001 #ifndef _theplu_yat_normalizer_gauss_ 00002 #define _theplu_yat_normalizer_gauss_ 00003 00004 // $Id: Gauss.h 2263 2010-05-26 22:13:07Z 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 "Spearman.h" 00027 #include "yat/utility/concept_check.h" 00028 #include "yat/utility/iterator_traits.h" 00029 00030 #include <boost/concept_check.hpp> 00031 00032 #include <gsl/gsl_cdf.h> 00033 00034 #include <iterator> 00035 00036 namespace theplu { 00037 namespace yat { 00038 namespace normalizer { 00039 00052 class Gauss 00053 { 00054 public: 00068 template<typename RandomAccessIter1, typename RandomAccessIter2> 00069 void operator()(RandomAccessIter1 first, RandomAccessIter1 last, 00070 RandomAccessIter2 result) const 00071 { 00072 BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIter1>)); 00073 BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIter2>)); 00074 BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIter1>)); 00075 BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<RandomAccessIter2>)); 00076 Spearman spearman; 00077 spearman(first, last, result); 00078 RandomAccessIter2 end = result + std::distance(first, last); 00079 utility::iterator_traits<RandomAccessIter2> trait; 00080 while (result != end) { 00081 trait.data(result) = gsl_cdf_ugaussian_Pinv(trait.data(result)); 00082 ++result; 00083 } 00084 } 00085 00086 00087 private: 00088 }; 00089 00090 }}} // end of namespace normalizer, yat and thep 00091 #endif