[83bb88]: / PDSim / misc / stl_utilities.pyx  Maximize  Restore  History

Download this file

17 lines (15 with data), 508 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from cython.operator cimport dereference as deref, preincrement as inc
cpdef bool is_in_vector(string a, vector[string] v):
cdef vector[string].iterator it = v.begin()
while it != v.end():
if deref(it) == a:
return True
#Increment iterator
inc(it)
return False
cpdef double get_map_sd(map[string, double] m, string s):
cdef map[string,double].iterator it = m.find(s)
if it != m.end():
return deref(it).second
else:
return 1e99