Skip to content

Commit ea2890a

Browse files
Some improvements for platform compatibility
1 parent daec9fe commit ea2890a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ot/lp/emd_wrap.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ def emd_1d_sorted(np.ndarray[double, ndim=1, mode="c"] u_weights,
157157
cost associated to the optimal transportation
158158
"""
159159
cdef double cost = 0.
160-
cdef int n = u_weights.shape[0]
161-
cdef int m = v_weights.shape[0]
160+
cdef Py_ssize_t n = u_weights.shape[0]
161+
cdef Py_ssize_t m = v_weights.shape[0]
162162

163-
cdef int i = 0
163+
cdef Py_ssize_t i = 0
164164
cdef double w_i = u_weights[0]
165-
cdef int j = 0
165+
cdef Py_ssize_t j = 0
166166
cdef double w_j = v_weights[0]
167167

168168
cdef double m_ij = 0.
@@ -171,7 +171,7 @@ def emd_1d_sorted(np.ndarray[double, ndim=1, mode="c"] u_weights,
171171
dtype=np.float64)
172172
cdef np.ndarray[long, ndim=2, mode="c"] indices = np.zeros((n + m - 1, 2),
173173
dtype=np.int)
174-
cdef int cur_idx = 0
174+
cdef Py_ssize_t cur_idx = 0
175175
while True:
176176
if metric == 'sqeuclidean':
177177
m_ij = (u[i] - v[j]) * (u[i] - v[j])

0 commit comments

Comments
 (0)