Reputation: 19184
I am working on c code conversion to python using numpy .
What is numpy equivalent of following matlab functions?
1. mxGetNumberOfDimensions
2. mxIsDouble
3. mxGetM
4. mxCreateDoubleMatrix
5. mxGetPr
6. lookupspline
Upvotes: 1
Views: 256
Reputation: 97331
assume a
is a ndarray object:
a = np.array([1.0, 2.0, 3.0])
mxGetNumberOfDimensions: a.ndim
mxIsDouble: a.dtype == float
mxGetM: a.shape[0]
mxCreateDoubleMatrix: np.zeros(...)
mxGetPr: a.data
or a.ctypes.data
lookupspline: sorry, I don't know what is this, there are some spline relate functions in scipy.interpolate
.
Upvotes: 2