2015-09-04 21:42:12 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
2015-07-26 14:33:49 +00:00
|
|
|
import sys
|
|
|
|
sys.path.append('.')
|
|
|
|
|
|
|
|
import example
|
2015-10-18 15:04:24 +00:00
|
|
|
try:
|
|
|
|
import numpy as np
|
|
|
|
except ImportError:
|
|
|
|
print('NumPy missing')
|
|
|
|
exit(0)
|
2015-07-26 14:33:49 +00:00
|
|
|
|
|
|
|
from example import vectorized_func
|
|
|
|
from example import vectorized_func2
|
2015-07-28 14:12:20 +00:00
|
|
|
from example import vectorized_func3
|
|
|
|
|
|
|
|
print(vectorized_func3(np.array(3+7j)))
|
2015-07-26 14:33:49 +00:00
|
|
|
|
|
|
|
for f in [vectorized_func, vectorized_func2]:
|
|
|
|
print(f(1, 2, 3))
|
|
|
|
print(f(np.array(1), np.array(2), 3))
|
|
|
|
print(f(np.array([1, 3]), np.array([2, 4]), 3))
|
|
|
|
print(f(np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3))
|
|
|
|
print(np.array([[1, 3, 5], [7, 9, 11]])* np.array([[2, 4, 6], [8, 10, 12]])*3)
|
2016-02-11 09:47:11 +00:00
|
|
|
print(f(np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2))
|
|
|
|
print(np.array([[1, 2, 3], [4, 5, 6]])* np.array([2, 3, 4])* 2)
|
|
|
|
print(f(np.array([[1, 2, 3], [4, 5, 6]]), np.array([[2], [3]]), 2))
|
|
|
|
print(np.array([[1, 2, 3], [4, 5, 6]])* np.array([[2], [3]])* 2)
|
|
|
|
|