mirror of
				https://github.com/aportelli/LatAnalyze.git
				synced 2025-11-04 08:04:32 +00:00 
			
		
		
		
	minor fixes in new physics classes
This commit is contained in:
		@@ -128,17 +128,17 @@ CorrelatorModels::ModelPar CorrelatorModels::parseModel(const string s)
 | 
			
		||||
    if (regex_match(s, sm, regex("exp([0-9]+)")))
 | 
			
		||||
    {
 | 
			
		||||
        par.type   = CorrelatorType::exp;
 | 
			
		||||
        par.nState = strTo<Index>(sm[0].str());
 | 
			
		||||
        par.nState = strTo<Index>(sm[1].str());
 | 
			
		||||
    }
 | 
			
		||||
    else if (regex_match(s, sm, regex("cosh([0-9]+)")))
 | 
			
		||||
    {
 | 
			
		||||
        par.type   = CorrelatorType::cosh;
 | 
			
		||||
        par.nState = strTo<Index>(sm[0].str());
 | 
			
		||||
        par.nState = strTo<Index>(sm[1].str());
 | 
			
		||||
    }
 | 
			
		||||
    else if (regex_match(s, sm, regex("sinh([0-9]+)")))
 | 
			
		||||
    {
 | 
			
		||||
        par.type   = CorrelatorType::sinh;
 | 
			
		||||
        par.nState = strTo<Index>(sm[0].str());
 | 
			
		||||
        par.nState = strTo<Index>(sm[1].str());
 | 
			
		||||
    }
 | 
			
		||||
    else if (s == "linear")
 | 
			
		||||
    {
 | 
			
		||||
@@ -189,7 +189,7 @@ DVec CorrelatorModels::parameterGuess(const DMatSample &corr,
 | 
			
		||||
                                      const ModelPar par)
 | 
			
		||||
{
 | 
			
		||||
    DVec  init;
 | 
			
		||||
    Index nt = corr.size();
 | 
			
		||||
    Index nt = corr[central].size();
 | 
			
		||||
 | 
			
		||||
    switch (par.type)
 | 
			
		||||
    {
 | 
			
		||||
@@ -234,6 +234,11 @@ CorrelatorFitter::CorrelatorFitter(const std::vector<DMatSample> &corr)
 | 
			
		||||
    setCorrelators(corr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
XYSampleData & CorrelatorFitter::data(void)
 | 
			
		||||
{
 | 
			
		||||
    return *data_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CorrelatorFitter::setCorrelator(const DMatSample &corr)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<DMatSample> vec;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,8 @@ class CorrelatorFitter
 | 
			
		||||
public:
 | 
			
		||||
    CorrelatorFitter(const DMatSample &corr);
 | 
			
		||||
    CorrelatorFitter(const std::vector<DMatSample> &corr);
 | 
			
		||||
    virtual ~CorrelatorFitter(void) = default;
 | 
			
		||||
    XYSampleData & data(void);
 | 
			
		||||
    void setCorrelator(const DMatSample &corr);
 | 
			
		||||
    void setCorrelators(const std::vector<DMatSample> &corr);
 | 
			
		||||
    const DMatSample & getCorrelator(const Index i = 0) const;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,8 +25,9 @@ using namespace Latan;
 | 
			
		||||
 | 
			
		||||
// constructors ////////////////////////////////////////////////////////////////
 | 
			
		||||
EffectiveMass::EffectiveMass(const CorrelatorType type)
 | 
			
		||||
: type_(type)
 | 
			
		||||
{}
 | 
			
		||||
{
 | 
			
		||||
    setType(type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// access //////////////////////////////////////////////////////////////////////
 | 
			
		||||
CorrelatorType EffectiveMass::getType(void) const
 | 
			
		||||
@@ -39,6 +40,31 @@ void EffectiveMass::setType(const CorrelatorType type)
 | 
			
		||||
    type_ = type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DVec EffectiveMass::getTime(const Index nt) const
 | 
			
		||||
{
 | 
			
		||||
    DVec tvec;
 | 
			
		||||
 | 
			
		||||
    switch (type_)
 | 
			
		||||
    {
 | 
			
		||||
    case CorrelatorType::undefined:
 | 
			
		||||
        LATAN_ERROR(Argument, "correlator type is undefined");
 | 
			
		||||
        break;
 | 
			
		||||
    case CorrelatorType::exp:
 | 
			
		||||
    case CorrelatorType::linear:
 | 
			
		||||
        tvec = DVec::LinSpaced(nt - 1, 0, nt - 2);
 | 
			
		||||
        break;
 | 
			
		||||
    case CorrelatorType::cosh:
 | 
			
		||||
    case CorrelatorType::sinh:
 | 
			
		||||
        tvec = DVec::LinSpaced(nt - 2, 1, nt - 2);
 | 
			
		||||
        break;
 | 
			
		||||
    case CorrelatorType::cst:
 | 
			
		||||
        tvec = DVec::LinSpaced(nt, 0, nt - 1);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return tvec;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// compute effective mass //////////////////////////////////////////////////////
 | 
			
		||||
DVec EffectiveMass::operator()(const DVec &corr) const
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ public:
 | 
			
		||||
    // access
 | 
			
		||||
    CorrelatorType getType(void) const;
 | 
			
		||||
    void           setType(const CorrelatorType type);
 | 
			
		||||
    DVec           getTime(const Index nt) const;
 | 
			
		||||
    // compute effective mass
 | 
			
		||||
    DVec       operator()(const DVec &corr) const;
 | 
			
		||||
    DMatSample operator()(const DMatSample &corr) const;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user