sam
sam

Reputation: 19184

equivalent functions in numpy

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

Answers (1)

HYRY
HYRY

Reputation: 97331

assume a is a ndarray object:

a = np.array([1.0, 2.0, 3.0])
  1. mxGetNumberOfDimensions: a.ndim

  2. mxIsDouble: a.dtype == float

  3. mxGetM: a.shape[0]

  4. mxCreateDoubleMatrix: np.zeros(...)

  5. mxGetPr: a.data or a.ctypes.data

  6. lookupspline: sorry, I don't know what is this, there are some spline relate functions in scipy.interpolate.

Upvotes: 2

Related Questions