Commit 7ba95a6d authored by Florian Goth's avatar Florian Goth
Browse files

add the covariance to the observables.

parent 2bbe308b
......@@ -599,19 +599,19 @@ catch (...)
A Helper function to generate the observables using the right data type. The data type depends on the template parameters
*/
template <typename ObsType, typename SignType>
void complex_obs_helper(std::vector<ObservableBase<SignType>*>& observables, int idx, const Parameters& curparams)
void complex_obs_helper(std::vector<ObservableBase<SignType>*>& observables, const Early_ObservableProperties& earlyprop, const Parameters& curparams)
{
const ObservableProperties& props(propertycache[idx]);
const ObservableProperties& props(propertycache[earlyprop.idx]);
switch (props.type)
{
case SCALAR:
observables.push_back(new Observable<ObsType, SignType >(props.name, curparams));
break;
case FUNCTION:
observables.push_back(new Observable<std::valarray<ObsType>, SignType>(props.name, curparams));
observables.push_back(new Observable<std::valarray<ObsType>, SignType>(props.name, curparams, earlyprop.covariance));
break;
case VECTORFUNCTION:
observables.push_back(new Observable<std::valarray<std::valarray<ObsType> >, SignType>(props.name, props.isk_space ?"k":"r", curparams));
observables.push_back(new Observable<std::valarray<std::valarray<ObsType> >, SignType>(props.name, props.isk_space ?"k":"r", curparams, earlyprop.covariance));
break;
default:
throw(std::runtime_error("this shouldn't happen... "));
......@@ -620,22 +620,22 @@ void complex_obs_helper(std::vector<ObservableBase<SignType>*>& observables, int
//Next follow various helpers that instantiate the complex_obs_helper to distinguish between the various possibilities of getting a complex or real sign
template <class Sign>
void branch_on_sign(bool obscomplex, std::vector<ObservableBase<Sign>*>& observables, int idx, const Parameters& curparams);
void branch_on_sign(bool obscomplex, std::vector<ObservableBase<Sign>*>& observables, const Early_ObservableProperties& earlyprop, const Parameters& curparams);
template <>
void branch_on_sign<double>(bool obscomplex, std::vector<ObservableBase<double>*>& observables, int idx, const Parameters& curparams)
void branch_on_sign<double>(bool obscomplex, std::vector<ObservableBase<double>*>& observables, const Early_ObservableProperties& earlyprop , const Parameters& curparams)
{
if (obscomplex)
complex_obs_helper<std::complex<double>, double>(observables, idx, curparams);
complex_obs_helper<std::complex<double>, double>(observables, earlyprop, curparams);
else
complex_obs_helper<double, double>(observables, idx, curparams);
complex_obs_helper<double, double>(observables, earlyprop, curparams);
return;
}
template <>
void branch_on_sign<std::complex<double> >(bool obscomplex, std::vector<ObservableBase<std::complex<double> >*>& observables, int idx, const Parameters& curparams)
void branch_on_sign<std::complex<double> >(bool obscomplex, std::vector<ObservableBase<std::complex<double> >*>& observables, const Early_ObservableProperties& earlyprop, const Parameters& curparams)
{
if (obscomplex)
complex_obs_helper<std::complex<double>, std::complex<double> >(observables, idx, curparams);
complex_obs_helper<std::complex<double>, std::complex<double> >(observables, earlyprop, curparams);
else
throw(std::runtime_error("Hey YOU! How should having a complex sign but a real observable work out?"));
return;
......@@ -738,7 +738,7 @@ void Master::run(std::vector<Parameters>::const_iterator curparams, std::list<Cl
for (typename std::vector<Early_ObservableProperties>::const_iterator it = observablenames.begin(); it != observablenames.end(); ++it)
{
bool iscomplexobservable = (curparams->signiscomplex || propertycache[it->idx].iscomplex);
branch_on_sign<SignType>(iscomplexobservable, observables, it->idx, *curparams);
branch_on_sign<SignType>(iscomplexobservable, observables, *it, *curparams);
}
const unsigned int currentsize = observables.front()->bin_nr();
for (int k = 1; k < static_cast<int>(observables.size()); ++k)
......
......@@ -75,7 +75,7 @@ public:
void commit();
void cacheData(Master&);
void analyzeData(const std::string&, AverageSign<SignType>&);
Observable(const std::string&, const Parameters&);
Observable(const std::string&, const Parameters&, bool);
unsigned int bin_nr()
{
return fv.size();
......@@ -90,7 +90,7 @@ private:
};
template <class ObsT, class SignType>
Observable<std::valarray<ObsT>, SignType>::Observable(const std::string& m, const Parameters& p) : ObservableBase<SignType>(m), functionpoints(
Observable<std::valarray<ObsT>, SignType>::Observable(const std::string& m, const Parameters& p, bool covariance = false) : ObservableBase<SignType>(m), functionpoints(
m.compare(0, 10, "KondoCloud") == 0 ? p.Nb*2*p.Nx:
p.functionpoints
), cache(functionpoints), delta_s(p.delta_s)
......@@ -109,7 +109,7 @@ public:
void commit();
void cacheData(Master&);
void analyzeData(const std::string&, AverageSign<SignType>&);
Observable(const std::string&, const std::string&, const Parameters&);
Observable(const std::string&, const std::string&, const Parameters&, bool);
unsigned int bin_nr();
private:
Observable(const Observable&);
......@@ -143,7 +143,7 @@ void Observable<std::valarray<std::valarray<ObsT> >, SignType>::commit()
}
template <class ObsT, class SignType>
Observable<std::valarray<std::valarray<ObsT> >, SignType>::Observable(const std::string& m, const std::string& in, const Parameters& p) : ObservableBase<SignType>(m), indexname(in),
Observable<std::valarray<std::valarray<ObsT> >, SignType>::Observable(const std::string& m, const std::string& in, const Parameters& p, bool covariance = false) : ObservableBase<SignType>(m), indexname(in),
tensorindices(
( p.is_Impurity_model?
(p.model == SIAM?p.N
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment