import numpy as np
if __name__ == "__main__":
a = np.array([1, 2, 3, 4, 5])
b = a.T
print(a.dot(b))
print('---')
c = np.array([[0, 1, 2, 3], [4, 5, 6, 7]])
print(c)
d = c.T
print(d)
print('---')
e = c.dot(d)
print(e)
输出:
55
---
[[0 1 2 3]
[4 5 6 7]]
[[0 4]
[1 5]
[2 6]
[3 7]]
---
[[ 14 38]
[ 38 126]]