"""Recursive function to convert np array in C++. This recusrive function deals with data of the np array. The header is generated by np2cpp function"""
ret="{"
foriinrange(x.shape[0]):
iftype(x[i])==np.ndarray:
ifi==x.shape[0]-1:
ret+=self.np2cppRec(x[i])[:-1]
else:
ret+=self.np2cppRec(x[i])
else:
ret+=str(x[i])+", "
ret=ret[:-2]+"}, "
returnret+"\n"
defnp2cpp(self,x,name,type="real"):
"""Generates cpp code associated to a numpy array, no matter its dimensions. It generates the header of the c++ vector. np2cppRec deals with inside data."""