【发布时间】:2014-04-01 01:21:47
【问题描述】:
我有一个c++函数
myfun(double* array, int n1, int n2);
我在 python 中与 numpy 交互。在我的接口文件中,我有
%apply (double* INPLACE_FARRAY2, int DIM1, int DIM2) {(double* inarray, int n1, int n2)}
现在,我想在 python 中将数组 b = array([[3,27.0],[2,9],[10,1]],order='F') 传递给 myfun,但出现以下错误
TypeError: Array must be contiguous. A non-contiguous array was given.
我做错了什么?我的%apply 语句中的双精度数据类型不正确吗?
【问题讨论】:
标签: python c++ arrays numpy swig