b = np.array([[2, 3, 4], [4, 5, 2]])
print(b*b)
result:
[[ 4 9 16]
[16 25 4]]
b = np.mat(b)
print(b*b.T)
result:
[[29 31]
[31 45]]
a = np.array('2 3 4, 4 5 2')
print(a*a)
print(type(a))
<class 'numpy.ndarray'>
print(a.shape)
()
print(a.size)
1
print(a.dtype)
<U12
result:
error
b = np.array([[2, 3, 4], [4, 5, 2], [2,7,3]])
print(b.dot(b))
result
[[24 49 26]
[32 51 32]
[38 62 31]]
b = np.array([[2, 3, 4], [4, 5, 2]])
print(b.dot(b))
result:
error
网友评论