一个二维的数组只需要一个维数的数组。 有办法吗?在
标题:
#ifndef __nparrtest_h__
#define __nparrtest_h__
class NPArrTest {
public:
static void Print2D(int n, int m, const int* graph);
};
#endif
Cpp:
^{pr2}$swig接口文件:
%module NPArrTest
%{
#define SWIG_FILE_WITH_INIT
#include "NPArrTest.h"
%}
%include "numpy.i"
%init %{
import_array1();
%}
%numpy_typemaps(int, NPY_INT , int)
//Something like the below:
%apply int DIM2, int* IN_ARRAY2 {int m, const int* graph};
%include "NPArrTest.h"
我不能让%apply (int DIM1, int* IN_ARRAY2) {(int m, const int* graph)};
或%apply int* IN_ARRAY2 {const int* graph};
工作(只通过2D数组的阶梯)。在
如何才能只将二维数组的一维长度值传递给c++函数?在
>
另外,有没有一种简单的方法来允许这种转换?在
TypeError:根据规则“safe”,无法将数组数据从dtype('int64')强制转换为dtype('int32')
目前没有回答
相关问题
PyPI热门下载资源包