Debian Codegraph @

tools/swig/test/Tensor.i

raw
1 // -*- c++ -*-
2 %module Tensor
3
4 %{
5 #define SWIG_FILE_WITH_INIT
6 #include "Tensor.h"
7 %}
8
9 // Get the NumPy typemaps
10 %include "../numpy.i"
11
12 %init %{
13 import_array();
14 %}
15
16 %define %apply_numpy_typemaps(TYPE)
17
18 %apply (TYPE IN_ARRAY3[ANY][ANY][ANY]) {(TYPE tensor[ANY][ANY][ANY])};
19 %apply (TYPE* IN_ARRAY3, int DIM1, int DIM2, int DIM3)
20 {(TYPE* tensor, int slices, int rows, int cols)};
21 %apply (int DIM1, int DIM2, int DIM3, TYPE* IN_ARRAY3)
22 {(int slices, int rows, int cols, TYPE* tensor)};
23
24 %apply (TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) {(TYPE array[3][3][3])};
25 %apply (TYPE* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3)
26 {(TYPE* array, int slices, int rows, int cols)};
27 %apply (int DIM1, int DIM2, int DIM3, TYPE* INPLACE_ARRAY3)
28 {(int slices, int rows, int cols, TYPE* array)};
29
30 %apply (TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) {(TYPE lower[2][2][2])};
31 %apply (TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) {(TYPE upper[2][2][2])};
32
33 %enddef /* %apply_numpy_typemaps() macro */
34
35 %apply_numpy_typemaps(signed char )
36 %apply_numpy_typemaps(unsigned char )
37 %apply_numpy_typemaps(short )
38 %apply_numpy_typemaps(unsigned short )
39 %apply_numpy_typemaps(int )
40 %apply_numpy_typemaps(unsigned int )
41 %apply_numpy_typemaps(long )
42 %apply_numpy_typemaps(unsigned long )
43 %apply_numpy_typemaps(long long )
44 %apply_numpy_typemaps(unsigned long long)
45 %apply_numpy_typemaps(float )
46 %apply_numpy_typemaps(double )
47
48 // Include the header file to be wrapped
49 %include "Tensor.h"