I have an array of float values that is created in regular Python, that I want to pass to a cython function that fronts for an underlying C function.
The C function requires
This is what I use for preparing arrays for passing to Cython, or C/CPP with SWIG.
import numpy as np
def make_c_array(a):
"""
Take an input numpy array and convert to being ready for use in C.
"""
b = []
for i in range(len(a)):
b.append(a[i])
a = np.array(b,dtype=np.dtype('d'),order='C')
return a