diff options
Diffstat (limited to 'lib/src/network.cpp')
-rw-r--r-- | lib/src/network.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/src/network.cpp b/lib/src/network.cpp index 027946a..43b0fab 100644 --- a/lib/src/network.cpp +++ b/lib/src/network.cpp @@ -95,13 +95,20 @@ network::~network() { } void network::set_thresholds(double beta, std::mt19937& rng) { - std::uniform_real_distribution<long double> d(0.0, 1.0); + if (beta == 0.0) { + /* zero beta doesn't make any sense computationally, we interpret it as "infinity" */ + for (long double& threshold : thresholds) { + threshold = 1.0; + } + } else { + std::uniform_real_distribution<long double> d(0.0, 1.0); - for (long double& threshold : thresholds) { - threshold = std::numeric_limits<long double>::lowest(); + for (long double& threshold : thresholds) { + threshold = std::numeric_limits<long double>::lowest(); - while (threshold == std::numeric_limits<long double>::lowest()) { - threshold = logl(d(rng)) / (long double)beta; + while (threshold == std::numeric_limits<long double>::lowest()) { + threshold = logl(d(rng)) / (long double)beta; + } } } } |