I have a function I'd like to abstract into an importable module:
cdef list generate_random_vectors(int num_vectors, int length, float scale=1):
cdef list return_list
np.random.seed()
return_list = []
for n in range(num_vectors):
return_list.append((1 - 2 * np.random.rand(length)) / scale)
return return_list
To put this in a module, I have to define it in the pxd file.
When I try this:
cdef list generate_random_vectors(int num_vectors, int length, float scale)
I get the error: Function signature does not match previous declaration.
When I try this:
cdef list generate_random_vectors(int num_vectors, int length, float scale=1)
I get the error: Expected ')', found 'INT'