mirror of
https://github.com/Flowseal/zapret-discord-youtube.git
synced 2025-06-23 23:00:07 -07:00
Create laba_21.py
This commit is contained in:
parent
87ee178546
commit
e1a9fbe062
21
laba_21.py
Normal file
21
laba_21.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import numpy as np
|
||||||
|
import time
|
||||||
|
|
||||||
|
n = 2048
|
||||||
|
A = np.random.rand(n, n) + 1j * np.random.rand(n, n)
|
||||||
|
B = np.random.rand(n, n) + 1j * np.random.rand(n, n)
|
||||||
|
C = np.zeros((n, n), dtype=np.complex128)
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
for i in range(n):
|
||||||
|
for j in range(n):
|
||||||
|
for k in range(n):
|
||||||
|
C[i, j] += A[i, k] * B[k, j]
|
||||||
|
end = time.time()
|
||||||
|
|
||||||
|
t = end - start
|
||||||
|
c = 2 * n**3
|
||||||
|
mflops = c / t * 1e-6
|
||||||
|
|
||||||
|
print(f"Время: {t:.2f} сек")
|
||||||
|
print(f"Производительность: {mflops:.2f} MFLOPS")
|
Loading…
Reference in New Issue
Block a user