00001 #include "C1DMTObjective.h"
00002 #include "MTRecObjective.h"
00003 #include "SeismicDataComp.h"
00004 #include "GradFunc.h"
00005 #include "CUniformRNG.h"
00006 #include "convert.h"
00007 #include <iostream>
00008 #include <fstream>
00009 #include <boost/numeric/ublas/io.hpp>
00010 #include <boost/numeric/bindings/lapack/lapack.hpp>
00011 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
00012 #include <boost/numeric/bindings/traits/ublas_vector.hpp>
00013 #include <boost/numeric/ublas/banded.hpp>
00014 #include <algorithm>
00015
00016 using namespace std;
00017 int main()
00018 {
00019 const int nparam = 6;
00020 const int nsamples = 10;
00021 CMTStation MTData;
00022 SeismicDataComp RecData;
00023 RecData.GetData("test.rec");
00024 MTData.GetData("test.mtt");
00025 C1DMTObjective MTObjective(MTData);
00026 MTObjective.AppendFitParameters(&MTTensor::GetRhoxy,&MTTensor::GetdRhoxy,0.01);
00027 MTObjective.AppendFitParameters(&MTTensor::GetPhixy,&MTTensor::GetdPhixy,0.01);
00028 MTRecObjective CombObjective(MTData,RecData,0,0.0,4.0,0.001,0.07);
00029
00030 ublas::vector<double> Model(nparam);
00031 Model(0) = 2;
00032 Model(1) = 0.1;
00033 Model(2) = 4;
00034 Model(3) = 10;
00035 Model(4) = 10;
00036 Model(5) = 10;
00037
00038
00039
00040
00041 double OldRMS = MTObjective.CalcPerformance(Model);
00042 MTObjective.CalcPerformance(Model);
00043 ublas::vector<double> OldData(MTObjective.GetSynthData());
00044 ModelAnalysis Analyser(MTObjective);
00045 Analyser.SetModel(Model);
00046 Analyser.SetRelativeSVDThreshold(1.0e-2);
00047
00048 cout << "Singular Values : " << Analyser.GetSingularValues() << endl;
00049 cout << "Analysis R: " << Analyser.GetModelResolution() << endl;
00050 cout << "Analysis Null: " << Analyser.GetModelNullspace() << endl;
00051
00052 ublas::vector<double> Projection(nparam), Perturb(nparam), NewModel(nparam);
00053 CUniformRNG Random;
00054 for (int sampleno = 0; sampleno < nsamples; ++sampleno)
00055 {
00056 for (int i = 0; i < nparam; ++i)
00057 Perturb(i) = Random.GetNumber();
00058 Projection = prod(Analyser.GetModelNullspace(),Perturb);
00059
00060 NewModel = Model+Projection;
00061
00062
00063 double NewRMS = MTObjective.CalcPerformance(NewModel);
00064 ublas::vector<double> NewData(MTObjective.GetSynthData());
00065 MTObjective.WritePlot("out"+stringify(sampleno));
00066 }
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 }