File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ function nested_commutator (term, n)
2+ if n == 0
3+ return term
4+ else
5+ return commutator (term, nested_commutator (term, n - 1 ))
6+ end
7+ end
8+
9+ function benchmark_commutator! (SUITE)
10+ h = FockSpace (:cavity )
11+ @qnumbers a:: Destroy (h)
12+
13+ term = a' * a
14+ n= 5
15+
16+ SUITE[" Micro Benchmarks" ][" Nested commutator" ] = @benchmarkable nested_commutator (
17+ $ term, $ n
18+ ) seconds = 20
19+ return nothing
20+ end
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ const SUITE = BenchmarkGroup()
55
66include (" SW.jl" )
77include (" numeric_conversion.jl" )
8+ include (" commutator.jl" )
89
910# benchmark_numeric_conversion!(SUITE) # need a more complex example (this one is too fast)
1011benchmark_Schrieffer_Wolf! (SUITE)
12+ benchmark_commutator! (SUITE)
1113
1214BenchmarkTools. tune! (SUITE)
1315results = BenchmarkTools. run (SUITE; verbose= true )
You can’t perform that action at this time.
0 commit comments