I want to pass 1 integer and 2 numpy array into the C function as followings:
void update_incident_field(int k, float *a, int na, float *b, int nb) {
for (i=0; i<na; i ++) {
a[i] = a[i] + b[i] * k;
}
}
But I don't know how to write the interface code (***.i)
Can someone help me?
Thanks!
The swig interface code I written(did't work, strange output)
%module example
%{
#define SWIG_FILE_WITH_INIT
#include "example.h"
%}
%include "numpy.i"
%init %{
import_array();
%}
%apply (float* INPLACE_ARRAY1, int DIM1) {(float *a, int na), (float *b, int nb)};
%include "example.h"