4
我使用痛飲從Python的numpy的數組傳遞給C++代碼:幾個numpy的陣列,痛飲
%include "numpy.i"
%init %{
import_array();
%}
%apply (float* INPLACE_ARRAY1, int DIM1) {(float* data, int n)};
class Class
{
public:
void test(float* data, int n)
{
//...
}
};
,並在Python:
c = Class()
a = zeros(5)
c.test(a)
這工作,但我怎麼能傳遞多個numpy的數組到相同的功能?
可以縮短在同一時間應用類型映射到兩個輸入對的申請指令一點點: %申請(浮動* INPLACE_ARRAY1,詮釋DIM1){(浮動*數據1,INT N1), (浮動* data2,int n2)}; – Martin 2010-07-19 14:51:05
感謝您的提示!我編輯了答案 – Petter 2010-07-20 13:45:54