summaryrefslogtreecommitdiffstats
path: root/src/Python/test.py
diff options
context:
space:
mode:
authordkazanc <dkazanc@hotmail.com>2017-10-26 13:58:24 +0100
committerGitHub <noreply@github.com>2017-10-26 13:58:24 +0100
commited7dd1150261eddbc8dc5cea9b46ced884d5a884 (patch)
tree9d67379252ad29345b516d9bad0ded2b32821933 /src/Python/test.py
parentc91436873e48d531b9313f9c10fa5f89bcb90ab6 (diff)
parent01861a7022cb7855bc1a8cd7f8cfd6282690a4f1 (diff)
downloadregularization-ed7dd1150261eddbc8dc5cea9b46ced884d5a884.tar.gz
regularization-ed7dd1150261eddbc8dc5cea9b46ced884d5a884.tar.bz2
regularization-ed7dd1150261eddbc8dc5cea9b46ced884d5a884.tar.xz
regularization-ed7dd1150261eddbc8dc5cea9b46ced884d5a884.zip
Merge pull request #8 from vais-ral/pythonize
Pythonize
Diffstat (limited to 'src/Python/test.py')
-rw-r--r--src/Python/test.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Python/test.py b/src/Python/test.py
new file mode 100644
index 0000000..db47380
--- /dev/null
+++ b/src/Python/test.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Thu Aug 3 14:08:09 2017
+
+@author: ofn77899
+"""
+
+import prova
+import numpy as np
+
+a = np.asarray([i for i in range(1*2*3)])
+a = a.reshape([1,2,3])
+print (a)
+b = prova.mexFunction(a)
+#print (b)
+print (b[4].shape)
+print (b[4])
+print (b[5])
+
+def print_element(input):
+ print ("f: {0}".format(input))
+
+prova.doSomething(a, print_element, None)
+
+c = []
+def append_to_list(input, shouldPrint=False):
+ c.append(input)
+ if shouldPrint:
+ print ("{0} appended to list {1}".format(input, c))
+
+def element_wise_algebra(input, shouldPrint=True):
+ ret = input - 7
+ if shouldPrint:
+ print ("element_wise {0}".format(ret))
+ return ret
+
+prova.doSomething(a, append_to_list, None)
+#print ("this is c: {0}".format(c))
+
+b = prova.doSomething(a, None, element_wise_algebra)
+#print (a)
+print (b[5])