00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef DISTRIBUTION_INVERTER_H 00014 #define DISTRIBUTION_INVERTER_H 00015 00016 #define TINY (1e-12) 00017 00018 #include <iostream> 00019 #include <string> 00020 #include <math.h> 00021 00022 #include "Array1D.h" 00023 #include "Random.h" 00024 #include "LinearSpline.h" 00025 00026 using namespace std; 00027 00032 class DistributionInverter 00033 { 00034 public: 00038 DistributionInverter(){;} 00039 00045 void operator=( const DistributionInverter & rhs ); 00046 00052 void initialize(Array1D<double> &x_input, 00053 Array1D<double> &y_input); 00054 00061 double random(); 00062 00063 private: 00064 //F_inverse=inverse(F); give me a y and I'll give you an x 00065 LinearSpline F_inverse; 00066 00075 void make_F_and_F_inverse(Array1D<double> &x_input, 00076 Array1D<double> &y_input); 00077 }; 00078 00079 00080 #endif 00081 00082 00083 00084