Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require C++11 #155

Merged
merged 3 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandana/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .network import Network

version = __version__ = '0.6'
version = __version__ = '0.6.1.dev0'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-
Expand Down Expand Up @@ -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"])

Expand Down
30 changes: 9 additions & 21 deletions src/accessibility.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "accessibility.h"
#include <algorithm>
#include <cmath>
#include <functional>
#include <utility>
#include "graphalg.h"

Expand All @@ -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<long>> edges,
Expand Down Expand Up @@ -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<double(const double &, const float &, const float &)> 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;
Expand All @@ -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];
Expand Down
13 changes: 1 addition & 12 deletions src/contraction_hierarchies/src/POIIndex/POIIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@

#include <vector>

#if defined _WIN32 || defined NO_TR1_MEMORY
#include <memory>
#else
// can we get rid of this tr1 stuff and use c++11 now?
#include <tr1/memory>
#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"
Expand Down