LnProbability
-
class LnProbability
Natural logarithm of a probability distribution.
Public Functions
-
LnProbability(const std::vector<double> &values)
Construct with given values.
-
double value(const int bin) const
Return the value of the bin.
-
double delta(const int bin) const
Return the difference of the logarithm of the probability distribution from its lower next value. Return ‘NaN’ if bin is zero.
-
void set_value(const int bin, const double value)
Set the value of the bin.
-
void add(const int bin, const double value_to_add)
Add to the value of the bin.
-
void resize(const int size)
Set the number of macrostates.
-
const std::vector<double> values() const
Return the values.
-
std::vector<double> delta_values() const
Return the delta values.
-
int size() const
Return the size of the distribution.
-
double sum_probability(const int min, const int max) const
Return the sum of the probability from min to max indices.
-
double sum_probability() const
Return the sum of the probability of all values.
-
void normalize()
Normalize such that the sum of the probability is unity.
-
std::vector<int> minima(const int num_smooth = 10) const
Return the local minimum indices which are canditates for phase boundary. The returned indices must be global minimum between +/- num_smooth.
-
double equilibrium_objective(const int num_smooth = 10) const
Return the objective function to minimize in order to obtain equilibrium between phases. If no phase boundaries, return the squared difference between the minimum and maximum values. If more than one, no current implementation. If exactly one, use objective function below.
- param num_smooth:
Number of macrostates which define ‘local’ region for finding the minimum.
-
double equilibrium_objective_boundary(int phase_boundary) const
Return the objective function to minimize in order to obtain equilibrium between phases. The objective is the squared difference between the natural logs of the probabilities of the two phases.
- param phase_boundary:
Index which is the boundary between phases. The exact index value is included in the second phase.
-
LnProbability reduce(const int keep_every, const int start = 0) const
Return a reduced lnpi by keeping every this many macrostates.
- param keep_every:
for keep_every == 2, return macrostates 0, 2, 4, 6…
- param start:
start from this value (default: 0). If negative, increment by keep_every
-
LnProbability(const std::vector<double> &values)