SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
parameter.cpp
Go to the documentation of this file.
1#include "parameter.h"
2
4{
5 range.resize(2);
6}
7
8double Parameter::GetVal(const string &quantity)
9{
10 if (quantity == "high")
11 return range[1];
12 else if (quantity == "low")
13 return range[0];
14 else
15 return 0;
16}
17
18void Parameter::SetRange(const vector<double> &rng)
19{
20 if (rng.size()==2)
21 range = rng;
23}
24
26{
27 if (range.size()==2)
28 {
29 if (lowhigh ==_range::low)
30 return range[0];
31 else
32 return range[1];
33 }
34 return 0;
35}
36void Parameter::SetRange(_range lowhigh, double value)
37{
38 if (range.size()!=2)
39 range.resize(2);
40 if (lowhigh ==_range::low)
41 range[0] = value;
42 else
43 range[1] = value;
45
46}
47
48void Parameter::SetRange(double low, double high)
49{
50 if (range.size()!=2)
51 range.resize(2);
52 range[0] = low;
53 range[1] = high;
54
56}
57
59{
60 range = param.range;
61 name = param.name;
63}
64
66{
67 range = param.range;
68 name = param.name;
70 return *this;
71}
72
89
91{
93}
94
95
vector< double > parameters
Distribution parameters vector.
double EvalLog(const double &x)
Evaluate natural logarithm of probability density.
distribution_type distribution
The type of probability distribution.
Represents a model parameter with prior distribution and constraints.
Definition parameter.h:73
double GetVal(const string &quantity)
Get range bound by string identifier.
Definition parameter.cpp:8
double value
Current value of the parameter.
Definition parameter.h:393
Parameter()
Default constructor.
Definition parameter.cpp:3
string name
Parameter name/identifier.
Definition parameter.h:381
double CalcLogPriorProbability(const double x)
Calculate log prior probability density at a given value.
Definition parameter.cpp:90
Distribution prior_distribution
The prior probability distribution for this parameter.
Definition parameter.h:357
double GetRange(_range lowhigh)
Get a specific range bound.
Definition parameter.cpp:25
vector< double > range
Allowable range for the parameter [low, high].
Definition parameter.h:373
void SetRange(const vector< double > &rng)
Set the parameter range from a vector.
Definition parameter.cpp:18
void UpdatePriorDistribution()
Update prior distribution parameters based on current range.
Definition parameter.cpp:73
Parameter & operator=(const Parameter &param)
Assignment operator.
Definition parameter.cpp:65
@ lognormal
Lognormal distribution: ln(x) ~ N(μ, σ²), for strictly positive variables.
@ normal
Normal (Gaussian) distribution: p(x) = N(μ, σ²)
_range
Enumeration for specifying parameter range bounds.
Definition parameter.h:13
@ low
Lower bound of the parameter range.
@ high
Upper bound of the parameter range.