Commit 2bbe308b authored by Florian Goth's avatar Florian Goth
Browse files

-add the possibility to specify whether one is interested in the covariance-matrix.

-a couple minor simplifications
parent 2d2e1112
......@@ -217,8 +217,8 @@ void Master::connectclient(const Client& c, const Parameters& curparams)
send<int32_t>(c, seed);//send the seeds
//now send all the used observables
send<uint32_t>(c, observablenames.size());//send the number of observables we want to measure
for (std::vector<int>::const_iterator it = observablenames.begin(); it != observablenames.end(); ++it)//send the observable names
send<string>(c, propertycache[*it].name);
for (std::vector<Early_ObservableProperties>::const_iterator it = observablenames.begin(); it != observablenames.end(); ++it)//send the observable names
send<string>(c, propertycache[it->idx].name);
send<char>(c, START);//finished sending configuration. let the zombie run!
return;
}
......@@ -546,27 +546,35 @@ try
unsigned int idx = 0;
while ((!stop) && (idx < nr_of_known_observables) )
{
std::string comp(propertycache[idx].name);
const ObservableProperties& props(propertycache[idx]);
std::string comp(props.name);
std::transform ( comp.begin() , comp.end() , comp.begin() , ::toupper );
if (comp == observable_ids[k])
{
if(!propertycache[idx].makes_only_sense_for_impurity)
if(!props.makes_only_sense_for_impurity || my_model_is_impurity_model)
{
observablenames.push_back(idx);
std::cout<<"Adding Observable: "<<propertycache[observablenames.back()].name<<std::endl;
Early_ObservableProperties earlyprop(idx);
if((props.type == VECTORFUNCTION) || (props.type == FUNCTION))
{
try
{
if(registry.Get<bool>("observables", props.name, "covariance"))
{
std::cout<<"Covariance-Matrix requested for "<< props.name<<std::endl;
earlyprop.covariance = true;
}
}
catch (Registry_Key_not_found_Exception& e)
{
std::cout<<e.what()<<std::endl;
}
}
observablenames.push_back(earlyprop);
std::cout<<"Adding Observable: "<<propertycache[observablenames.back().idx].name<<std::endl;
stop = true;
}
else
{
if(my_model_is_impurity_model)
{
observablenames.push_back(idx);
std::cout<<"Adding Observable: "<<propertycache[observablenames.back()].name<<std::endl;
stop = true;
}
else
std::cout<<"Not adding "<<propertycache[idx].name<<"! It makes no sense for an impurity model."<<std::endl;
}
}
else
++idx;
......@@ -593,16 +601,17 @@ A Helper function to generate the observables using the right data type. The dat
template <typename ObsType, typename SignType>
void complex_obs_helper(std::vector<ObservableBase<SignType>*>& observables, int idx, const Parameters& curparams)
{
switch (propertycache[idx].type)
const ObservableProperties& props(propertycache[idx]);
switch (props.type)
{
case SCALAR:
observables.push_back(new Observable<ObsType, SignType >(propertycache[idx].name, curparams));
observables.push_back(new Observable<ObsType, SignType >(props.name, curparams));
break;
case FUNCTION:
observables.push_back(new Observable<std::valarray<ObsType>, SignType>(propertycache[idx].name, curparams));
observables.push_back(new Observable<std::valarray<ObsType>, SignType>(props.name, curparams));
break;
case VECTORFUNCTION:
observables.push_back(new Observable<std::valarray<std::valarray<ObsType> >, SignType>(propertycache[idx].name, propertycache[idx].isk_space ?"k":"r", curparams));
observables.push_back(new Observable<std::valarray<std::valarray<ObsType> >, SignType>(props.name, props.isk_space ?"k":"r", curparams));
break;
default:
throw(std::runtime_error("this shouldn't happen... "));
......@@ -726,10 +735,10 @@ void Master::run(std::vector<Parameters>::const_iterator curparams, std::list<Cl
AverageSign<SignType> sign(curparams->binpath);
std::vector<ObservableBase<SignType>*> observables;//herein we store all observables
//create the various observables
for (typename std::vector<int>::const_iterator it = observablenames.begin(); it != observablenames.end(); ++it)
for (typename std::vector<Early_ObservableProperties>::const_iterator it = observablenames.begin(); it != observablenames.end(); ++it)
{
bool iscomplexobservable = (curparams->signiscomplex || propertycache[*it].iscomplex);
branch_on_sign<SignType>(iscomplexobservable, observables, *it, *curparams);
bool iscomplexobservable = (curparams->signiscomplex || propertycache[it->idx].iscomplex);
branch_on_sign<SignType>(iscomplexobservable, observables, it->idx, *curparams);
}
const unsigned int currentsize = observables.front()->bin_nr();
for (int k = 1; k < static_cast<int>(observables.size()); ++k)
......
......@@ -75,6 +75,15 @@ struct Parameters
template <class SignType>
class ClientState; //forward declaration
struct Early_ObservableProperties
{
int idx;
bool covariance;
Early_ObservableProperties() : covariance(false) {}
Early_ObservableProperties(int i) : idx(i), covariance(false) {}
Early_ObservableProperties(int i, bool c) : idx(i), covariance(c) {}
};
class Master : public ParallelServer
{
public:
......@@ -96,7 +105,7 @@ private:
char* readinDatafromFiles(class RegistryDB&, uint, uint&);
template <typename SignType>
void wait_for_all_clients_to_stop(std::list<ClientState<SignType> >& clients, std::ofstream&);
std::vector<int> observablenames;
std::vector<Early_ObservableProperties> observablenames;
template <typename SignType>
inline int handleActivity(std::list<ClientState<SignType> >& clients, std::ofstream&);
template <typename ClientContainer>
......
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