[Numpy-discussion] numpy C++ swig class example
Rubin, Jared
JARED.RUBIN@saic....
Tue Jun 9 21:52:43 CDT 2009
I am using the numpy.i interface file and have gotten the cookbook/swig example to work from scipy.
Are there any examples of appyling the numpy.i to a C++ header file. I would like to generate a lightweight
Array2D class that just uses doubles and would have the following header file
Array2D.h
=========
class Array2D {
public:
int _nrow;
int _ncol;
double* data;
Array2DD(int nrow, int ncol, double *data);
}
// I would expect the have the following Array2D.i interface file
%module array2DD
%{
#define SWIG_FILE_WITH_INIT
#include "Array2D.h"
%}
%include "numpy.i"
%init %{
import_array();
%}
%ignore Array2D();
%ignore Array2D(long nrow, long ncol);
%apply (int DIM1, int DIM2, double* IN_ARRAY2) {(int nrow, int ncol, double *data)}
%include "Array2D.h"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090609/21aed1be/attachment-0001.html
More information about the Numpy-discussion
mailing list