I have some code from a colleague using cython.weave
to wrap a function from a C++ library:
def partialsort(a, K):
support_code = "#include <algorithm>"
code = "std::partial_sort (&ak(0), &ak(K), &ak(N));"
N = len(a)
ak = a.copy()
vars = ['ak', 'K', 'N']
s = weave.inline(code, vars, support_code=support_code,
type_converters=converters.blitz)
With the Weave tool gone I would like to replace this by Cython, if possible. So far I have tried my luck based on http://docs.cython.org/en/latest/src/userguide/external_C_code.html and attempted the following in a Cython module, just to check if I can access the library at all:
cdef extern from "<algorithm>":
pass
When I try to build the Cython module, I get following error:
csorting.c:604:10: fatal error: algorithm: No such file or `folder
#include <algorithm>
^~~~~~~~~~~
compilation terminated.
As far as I can understand, <algorithm>
is a C++ library. Is C++ the problem here? I have g++
, but the Cython build set-up uses gcc
. Is <algorithm>
a library that has to be installed individually?