From 222edf01cc189b21f0f27b32f0e67c0a99b41a48 Mon Sep 17 00:00:00 2001 From: Sam Maurer Date: Tue, 22 Dec 2020 15:17:41 -0800 Subject: [PATCH 1/3] Reversing PR #123 --- src/accessibility.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/src/accessibility.cpp b/src/accessibility.cpp index cedb588a..5c3ec2bd 100644 --- a/src/accessibility.cpp +++ b/src/accessibility.cpp @@ -1,6 +1,7 @@ #include "accessibility.h" #include #include +#include #include #include "graphalg.h" @@ -18,22 +19,6 @@ bool distance_node_pair_comparator(const distance_node_pair& l, { return l.first < r.first; } -double exp_decay(const double &distance, const float &radius, const float &var) -{ - return exp(-1*distance/radius) * var; -} - -double linear_decay(const double &distance, const float &radius, const float &var) -{ - return (1.0-distance/radius) * var; -} - -double flat_decay(const double &distance, const float &radius, const float &var) -{ - return var; -} - - Accessibility::Accessibility( int numnodes, vector< vector> edges, @@ -401,14 +386,17 @@ Accessibility::aggregateAccessibilityVariable( double sum = 0.0; double sumsq = 0.0; - double (*sum_function_ptr)(const double &, const float &, const float &); + std::function sum_function; if(decay == "exp") - sum_function_ptr = &exp_decay; + sum_function = [](const double &distance, const float &radius, const float &var) + { return exp(-1*distance/radius) * var; }; if(decay == "linear") - sum_function_ptr = &linear_decay; + sum_function = [](const double &distance, const float &radius, const float &var) + { return (1.0-distance/radius) * var; }; if(decay == "flat") - sum_function_ptr = &flat_decay; + sum_function = [](const double &distance, const float &radius, const float &var) + { return var; }; for (int i = 0 ; i < distances.size() ; i++) { int nodeid = distances[i].first; @@ -419,7 +407,7 @@ Accessibility::aggregateAccessibilityVariable( for (int j = 0 ; j < vars[nodeid].size() ; j++) { cnt++; // count items - sum += (*sum_function_ptr)(distance, radius, vars[nodeid][j]); + sum += sum_function(distance, radius, vars[nodeid][j]); // stddev is always flat sumsq += vars[nodeid][j] * vars[nodeid][j]; From b1a9449f75b8036319f8e89c14cd018c65753087 Mon Sep 17 00:00:00 2001 From: Sam Maurer Date: Tue, 22 Dec 2020 16:28:02 -0800 Subject: [PATCH 2/3] Removing tr1 conditionals --- setup.py | 2 +- src/contraction_hierarchies/src/POIIndex/POIIndex.h | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index ee85fbd5..5a5a82a2 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ def run(self): if sys.platform.startswith('darwin'): # Mac - extra_compile_args += ['-D NO_TR1_MEMORY', '-stdlib=libc++'] + extra_compile_args += ['-stdlib=libc++'] extra_link_args += ['-stdlib=libc++'] # The default compiler that ships with Macs doesn't support OpenMP multi- diff --git a/src/contraction_hierarchies/src/POIIndex/POIIndex.h b/src/contraction_hierarchies/src/POIIndex/POIIndex.h index 5d442fa0..bd699403 100644 --- a/src/contraction_hierarchies/src/POIIndex/POIIndex.h +++ b/src/contraction_hierarchies/src/POIIndex/POIIndex.h @@ -22,18 +22,7 @@ #include -#if defined _WIN32 || defined NO_TR1_MEMORY -#include -#else -// can we get rid of this tr1 stuff and use c++11 now? -#include -#endif - -#ifdef NO_TR1_MEMORY - using std::shared_ptr; -#else -#define shared_ptr tr1::shared_ptr -#endif +using std::shared_ptr; #include "../BasicDefinitions.h" #include "../DataStructures/BinaryHeap.h" From 34a990be9f00775ab00901a86e580073b1465713 Mon Sep 17 00:00:00 2001 From: Sam Maurer Date: Tue, 22 Dec 2020 16:33:17 -0800 Subject: [PATCH 3/3] Versioning --- pandana/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandana/__init__.py b/pandana/__init__.py index f50d2441..d46f0c76 100644 --- a/pandana/__init__.py +++ b/pandana/__init__.py @@ -1,3 +1,3 @@ from .network import Network -version = __version__ = '0.6' +version = __version__ = '0.6.1.dev0' diff --git a/setup.py b/setup.py index 5a5a82a2..7ac824c9 100644 --- a/setup.py +++ b/setup.py @@ -126,7 +126,7 @@ def run(self): ## Standard setup ############################################### -version = '0.6' +version = '0.6.1.dev0' packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])