summaryrefslogtreecommitdiffstats
path: root/src/Python/test.py
blob: db47380c52cb74d7943cb20cd5453defad86a7a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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])