20 lines
462 B
Python
20 lines
462 B
Python
import scisoftpy as np
|
|
|
|
print "Meshgrid testing"
|
|
x = np.arange(0, 6, 1)
|
|
y = np.arange(0, 4, 1)
|
|
xy = np.meshgrid(x, y)
|
|
xy = np.meshgrid(x, y, indexing="ij")
|
|
print xy
|
|
|
|
|
|
a = np.arange(1, 9).reshape(2, 2, 2)
|
|
b = np.array([-2, -3, 5, 7]).reshape(2, 2)
|
|
self.checkitems([35, 63], np.tensordot(a, b))
|
|
self.checkitems([63, 70], np.tensordot(b, a))
|
|
a = np.arange(60.0).reshape(3, 4, 5)
|
|
b = np.arange(24.0).reshape(4, 3, 2)
|
|
print np.tensordot(a, b, axes=([1, 0], [0, 1])
|
|
|
|
|