Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | d4258ba | 2015-07-26 16:33:49 +0200 | [diff] [blame] | 3 | import sys |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | import example |
Wenzel Jakob | fab881c | 2015-10-18 17:04:24 +0200 | [diff] [blame] | 7 | try: |
| 8 | import numpy as np |
| 9 | except ImportError: |
| 10 | print('NumPy missing') |
| 11 | exit(0) |
Wenzel Jakob | d4258ba | 2015-07-26 16:33:49 +0200 | [diff] [blame] | 12 | |
| 13 | from example import vectorized_func |
| 14 | from example import vectorized_func2 |
Wenzel Jakob | 43398a8 | 2015-07-28 16:12:20 +0200 | [diff] [blame] | 15 | from example import vectorized_func3 |
| 16 | |
| 17 | print(vectorized_func3(np.array(3+7j))) |
Wenzel Jakob | d4258ba | 2015-07-26 16:33:49 +0200 | [diff] [blame] | 18 | |
| 19 | for f in [vectorized_func, vectorized_func2]: |
| 20 | print(f(1, 2, 3)) |
| 21 | print(f(np.array(1), np.array(2), 3)) |
| 22 | print(f(np.array([1, 3]), np.array([2, 4]), 3)) |
| 23 | print(f(np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3)) |
| 24 | print(np.array([[1, 3, 5], [7, 9, 11]])* np.array([[2, 4, 6], [8, 10, 12]])*3) |
Johan Mabille | 1dc960c | 2016-02-11 10:47:11 +0100 | [diff] [blame^] | 25 | print(f(np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2)) |
| 26 | print(np.array([[1, 2, 3], [4, 5, 6]])* np.array([2, 3, 4])* 2) |
| 27 | print(f(np.array([[1, 2, 3], [4, 5, 6]]), np.array([[2], [3]]), 2)) |
| 28 | print(np.array([[1, 2, 3], [4, 5, 6]])* np.array([[2], [3]])* 2) |
| 29 | |