Skip to content

Commit

Permalink
now works for no reason. apparently a cython bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
fxjung committed Aug 14, 2024
1 parent 8ccf323 commit ee2a8d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"setuptools",
"wheel",
"Cython==3.0a6",
"Cython>=3",
]
build-backend = "setuptools.build_meta"

Expand Down
8 changes: 5 additions & 3 deletions src/ridepy/util/spaces_cython/boost_graph_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ class GraphSpace : public TransportSpace<vertex_t> {
GraphSpace(double velocity, vector<vertex_t> vertex_vec,
vector<Edge> edge_vec, vector<double> weight_vec)
: TransportSpace<vertex_t>(),
velocity(velocity), _g{vertex_vec.size()}, vertex2label{get(vertex_name,
_g)},
velocity(velocity),
_g{vertex_vec.size()},
vertex2label{get(vertex_name, _g)},
_distances(static_cast<int>(vertex_vec.size())),
_predecessors(static_cast<int>(vertex_vec.size())),
_weights{weight_vec}, edge2weight{get(edge_weight, _g)} {
_weights{weight_vec},
edge2weight{get(edge_weight, _g)} {
// this->vertex2label = get(vertex_name, this->_g);
// add vertex properties
int idx = 0;
Expand Down
12 changes: 6 additions & 6 deletions src/ridepy/util/spaces_cython/spaces.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,19 @@ cdef class Graph(TransportSpace):
self.loc_type = LocType.INT

if weights is None:
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[ulonglong](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges
<vector[ulonglong]>vertices,
<vector[pair[ulonglong, ulonglong]]>edges
)
else:
if isinstance(weights, (int, float)):
weights = it.repeat(float(weights), len(edges))

self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[ulonglong](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges,
<vector[ulonglong]>vertices,
<vector[pair[ulonglong, ulonglong]]>edges,
<vector[double]>weights
)

Expand Down

0 comments on commit ee2a8d6

Please sign in to comment.