summaryrefslogtreecommitdiff
path: root/lib/src/network.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-02-24 17:19:52 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-02-24 17:19:52 -0500
commitf861195c1416220c4039bda4d1cbf8c3aab07528 (patch)
treed9fefc81db9a471b1c1ec7ca640041365adfce30 /lib/src/network.cpp
parentaca81428ac3e7385294d8fc871b9618b739a8109 (diff)
downloadfuse_networks-f861195c1416220c4039bda4d1cbf8c3aab07528.tar.gz
fuse_networks-f861195c1416220c4039bda4d1cbf8c3aab07528.tar.bz2
fuse_networks-f861195c1416220c4039bda4d1cbf8c3aab07528.zip
added support for specifiying voronoi graphs with number of points and aspect ratio, and added support for "infinite" beta (everything has the some threshold)
Diffstat (limited to 'lib/src/network.cpp')
-rw-r--r--lib/src/network.cpp17
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;
+ }
}
}
}