Compare commits
No commits in common. "388be36ab1f659567b843b4704de456234194292" and "2bb0a1ab9b4ffc2805ab517433fcef2d2386345b" have entirely different histories.
388be36ab1
...
2bb0a1ab9b
@ -1,20 +0,0 @@
|
||||
import numpy as np
|
||||
import time
|
||||
|
||||
numpy_array = np.arange(0,1e5,1)
|
||||
times = 1000
|
||||
|
||||
from numba import jit
|
||||
from numba import prange
|
||||
@jit(nopython=True, parallel=True)
|
||||
def numba_example(numpy_array):
|
||||
sum = 0
|
||||
for i in prange(len(numpy_array)):
|
||||
sum += numpy_array[i]
|
||||
return sum
|
||||
|
||||
start = time.time()
|
||||
for _ in range(times):
|
||||
result = numba_example(numpy_array)
|
||||
end = time.time()
|
||||
print(f'运行时间:{end - start}')
|
@ -1,16 +0,0 @@
|
||||
# 检查是否为厄米矩阵(相对误差为1e-5)
|
||||
import guan
|
||||
|
||||
matrix1 = [
|
||||
[2, 1.00001-1j],
|
||||
[1+1j, 1]
|
||||
]
|
||||
|
||||
print(guan.is_hermitian(matrix1))
|
||||
|
||||
matrix2 = [
|
||||
[2, 1.00002-1j],
|
||||
[1+1j, 1]
|
||||
]
|
||||
|
||||
print(guan.is_hermitian(matrix2))
|
@ -1,7 +1,7 @@
|
||||
# 运行时间日志
|
||||
# 运行统计
|
||||
import guan
|
||||
import time
|
||||
guan.logging_with_day_and_time(content='start')
|
||||
guan.statistics_with_day_and_time(content='start')
|
||||
for i in range(3):
|
||||
time.sleep(5)
|
||||
guan.logging_with_day_and_time(f'end_of_{i}')
|
||||
guan.statistics_with_day_and_time(f'end_of_{i}')
|
@ -5,11 +5,11 @@ import guan
|
||||
def test1(a, b):
|
||||
import time
|
||||
print(a)
|
||||
time.sleep(1)
|
||||
time.sleep(2)
|
||||
print(b)
|
||||
print('Run finished.')
|
||||
|
||||
for _ in range(2):
|
||||
for _ in range(3):
|
||||
test1(10, b=20)
|
||||
|
||||
print()
|
||||
@ -17,9 +17,9 @@ print()
|
||||
def test2(a, b):
|
||||
import time
|
||||
print(a)
|
||||
time.sleep(1)
|
||||
time.sleep(2)
|
||||
print(b)
|
||||
print('Run finished.')
|
||||
|
||||
for _ in range(2):
|
||||
guan.timer(test2, 100, b=200)
|
||||
for _ in range(3):
|
||||
guan.timer(test2, 10, b=20)
|
Loading…
x
Reference in New Issue
Block a user