+ restructured test cases
[qpalma.git] / DynProg / QPalmaDP.i
1 %module QPalmaDP
2 %{
3 #define SWIG_FILE_WITH_INIT
4 #include "common.h"
5 #include "Mathmatics.h"
6 #include "penalty_info.h"
7 #include "qpalma_dp.h"
8 %}
9
10 %include "carrays.i"
11
12 %include "common.h"
13 %include "Mathmatics.h"
14 %include "penalty_info.h"
15 %include "qpalma_dp.h"
16
17 %array_class(int, intArray) ;
18 %array_class(double, doubleArray) ;
19 %array_functions(struct penalty_struct, penaltyArray) ;
20
21 /*
22 %array_functions(double, doubleFArray) ;
23 %array_class(Pre_score, Pre_scoreArray) ;
24 */
25
26 %pythoncode
27 %{
28
29 def createPenaltyArrayFromList(list):
30 array = new_penaltyArray(len(list))
31 for i in range(len(list)):
32 penaltyArray_setitem(array, i, list[i])
33 return array
34
35 def createDoubleArrayFromList(list):
36 #array = new_doubleArray(len(list))
37 array = doubleArray(len(list))
38 for i in range(len(list)):
39 # doubleArray_setitem(array, i, list[i])
40 array[i] = list[i]
41 return array
42
43 def createIntArrayFromList(list):
44 #array = new_intArray(len(list))
45 array = intArray(len(list))
46 for i in range(len(list)):
47 #intArray_setitem(array, i, list[i])
48 array[i] = list[i]
49 return array
50
51 def createListFromIntArray(array, array_len):
52 list = [0]*array_len
53 for i in range(array_len):
54 list[i] = intArray_getitem(array,i)
55 return list
56
57 def createListFromDoubleArray(array, array_len):
58 list = [0]*array_len
59 for i in range(array_len):
60 list[i] = doubleArray_getitem(array,i)
61 return list
62 %}