Skip to content

Commit 80227f5

Browse files
committed
add benchmarks
1 parent 3822a2e commit 80227f5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tests/test_pcca.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,24 @@ def test_krylovschur(n=30, m=5, N=100):
4949
K = pcca.krylovschur(A, m)
5050
R = np.linalg.matrix_rank(np.concatenate([S, K], axis=1), tol=1e-6)
5151
assert R == m
52+
53+
54+
def test_bench_scipyschur(benchmark, n=500, m=6):
55+
T = utils.randompropagator(n)
56+
massmatrix = np.diag(np.ones(n))
57+
solver = pcca.ScipySchur()
58+
benchmark(solver.solve, T, m, massmatrix)
59+
60+
61+
def test_bench_scipyqz(benchmark, n=500, m=6):
62+
T = utils.randompropagator(n)
63+
solver = pcca.ScipySchur()
64+
benchmark(solver.solve, T, m)
65+
66+
67+
def test_bench_krylovschur(benchmark, n=500, m=6):
68+
if not pcca.HAS_SLEPC:
69+
return
70+
T = utils.randompropagator(n)
71+
solver = pcca.KrylovSchur(onseperation="continue")
72+
benchmark(solver.solve, T, m)

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ envlist = py37, py27
1010
deps =
1111
pytest
1212
pytest-cov
13+
pytest-benchmark
1314
commands =
14-
pytest --cov=cmdtools --cov-report term-missing
15+
pytest --cov=cmdtools --cov-report term-missing --benchmark-skip

0 commit comments

Comments
 (0)