MTSampleGenerator.h

Go to the documentation of this file.
00001 #ifndef MTSAMPLEGENERATOR_H_
00002 #define MTSAMPLEGENERATOR_H_
00003 #include <boost/function.hpp>
00004 #include <boost/random/lagged_fibonacci.hpp>
00005 #include <boost/random/normal_distribution.hpp>
00006 #include <boost/random/variate_generator.hpp>
00007 #include <complex>
00008 #include "MTTensor.h"
00009 
00010 namespace gplib
00011   {
00012 
00013     /** \addtogroup statistics Statistical methods */
00014     /* @{ */
00015 
00016     //! Generate random elements of a calculated quantity for MT impedance data
00017     /*! This class is used for error analysis of MT data using the Bootstrap or Jacknife method.
00018      * The constructor takes a pointer to a member function of MTTensor f, a Tensor element Z and an errorlevel
00019      * and generates random  samples f(Z) within the errorlevel for the impedance.
00020      * Each call to operator() yields a new sample
00021      */
00022     class MTSampleGenerator
00023       {
00024     private:
00025       boost::lagged_fibonacci607 generator;
00026       boost::normal_distribution<> Zxxr_dist;
00027       boost::normal_distribution<> Zxxi_dist;
00028       boost::normal_distribution<> Zxyr_dist;
00029       boost::normal_distribution<> Zxyi_dist;
00030       boost::normal_distribution<> Zyxr_dist;
00031       boost::normal_distribution<> Zyxi_dist;
00032       boost::normal_distribution<> Zyyr_dist;
00033       boost::normal_distribution<> Zyyi_dist;
00034 
00035       boost::variate_generator<boost::lagged_fibonacci607&,
00036           boost::normal_distribution<> > Zxxr;
00037       boost::variate_generator<boost::lagged_fibonacci607&,
00038           boost::normal_distribution<> > Zxxi;
00039       boost::variate_generator<boost::lagged_fibonacci607&,
00040           boost::normal_distribution<> > Zxyr;
00041       boost::variate_generator<boost::lagged_fibonacci607&,
00042           boost::normal_distribution<> > Zxyi;
00043       boost::variate_generator<boost::lagged_fibonacci607&,
00044           boost::normal_distribution<> > Zyxr;
00045       boost::variate_generator<boost::lagged_fibonacci607&,
00046           boost::normal_distribution<> > Zyxi;
00047       boost::variate_generator<boost::lagged_fibonacci607&,
00048           boost::normal_distribution<> > Zyyr;
00049       boost::variate_generator<boost::lagged_fibonacci607&,
00050           boost::normal_distribution<> > Zyyi;
00051       boost::function<double(const MTTensor*)> func;
00052       MTTensor Data;
00053     public:
00054       //! The constructor needs a pointer to a member function of MTTensor that returns a double, an impedance element and an errolevel for all elements
00055       /*! For example MTSampleGenerator(&MTTensor::GetRhoxy,DistData) creates a distribution of Zxy apparent resistivity
00056        * values that is purely based on the impedance errors in DistData, if an errorlevel was specified this
00057        * would be the error floor.*/
00058       MTSampleGenerator(boost::function<double(const MTTensor*)> f,
00059           const MTTensor &Z, const double errorlevel = 0.0);
00060       //! each call to operator() returns a new random sample
00061       double operator()();
00062       virtual ~MTSampleGenerator();
00063       };
00064   /* @} */
00065   }
00066 #endif /*MTSAMPLEGENERATOR_H_*/

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8