import time
import numpy as np
a = np.random.random((5000,5000))
t1 = time.time()
b = np.matmul(a, a)
t2 = time.time()
print(t2-t1)
本人電腦耗時穩定在4s-5s之間
tic
a = rand(5000,5000);
b = a * a;
toc
matlab的耗時也在4s-5s之間, 兩者相差不大
import time
import numpy as np
a = np.random.random((5000,5000))
t1 = time.time()
b = np.matmul(a, a)
t2 = time.time()
print(t2-t1)
本人電腦耗時穩定在4s-5s之間
tic
a = rand(5000,5000);
b = a * a;
toc
matlab的耗時也在4s-5s之間, 兩者相差不大