MTRecObjective.cpp

Go to the documentation of this file.
00001 #include "MTRecObjective.h"
00002 #include <boost/numeric/ublas/matrix_proxy.hpp>
00003 #include <boost/numeric/ublas/vector_proxy.hpp>
00004 #include <boost/bind.hpp>
00005 #include <algorithm>
00006 #include <iostream>
00007 #include "Adaptors.h"
00008 
00009 namespace gplib
00010   {
00011     MTRecObjective::MTRecObjective(const CMTStation &LocalMTData,
00012         SeismicDataComp &TheRecData, const int myshift, const double myomega,
00013         const double mysigma, const double myc, const double myslowness) :
00014       recweight(1), RecObjective(TheRecData, myshift, myomega, mysigma, myc,
00015           myslowness), MTObjective(LocalMTData)
00016       {
00017 
00018       }
00019 
00020     MTRecObjective::~MTRecObjective()
00021       {
00022       }
00023 
00024     double MTRecObjective::PostParallel(const ttranscribed &member)
00025       {
00026         const int nlayers = member.size() / 3;
00027         ttranscribed mtmember(nlayers * 2), recmember(nlayers * 2);
00028         mtmember = ublas::project(member, ublas::range(0, nlayers * 2));
00029         recmember = ublas::project(member, ublas::range(nlayers, nlayers * 3));
00030         double mtperf = MTObjective.CalcPerformance(mtmember);
00031         double recperf = RecObjective.CalcPerformance(recmember);
00032         const int ndata = MTObjective.GetSynthData().size()
00033             + RecObjective.GetSynthData().size();
00034         SetMisfit().resize(ndata); //make sure Misfit in base class can hold enough elements
00035         SetSynthData().resize(ndata); // and same for data
00036         project(SetSynthData(), ublas::range(0,
00037             MTObjective.GetSynthData().size())) = MTObjective.GetSynthData();
00038         project(SetSynthData(), ublas::range(MTObjective.GetSynthData().size(),
00039             MTObjective.GetSynthData().size()
00040                 + RecObjective.GetSynthData().size()))
00041             = RecObjective.GetSynthData();
00042         project(SetMisfit(), ublas::range(0, MTObjective.GetMisfit().size()))
00043             = MTObjective.GetMisfit();
00044         project(SetMisfit(), ublas::range(MTObjective.GetMisfit().size(),
00045             MTObjective.GetMisfit().size() + RecObjective.GetMisfit().size()))
00046             = RecObjective.GetMisfit();
00047         SetRMS(mtperf + recweight * recperf);
00048 
00049         return mtperf + recweight * recperf;
00050       }
00051   }

Generated on Tue Nov 3 13:24:14 2009 for GPLIB++ by  doxygen 1.5.8