@@ -6,24 +6,26 @@ using YaoLocations
6
6
using BQCESubroutine: threaded_basic_broutine!
7
7
using Polyester
8
8
9
- @testset " BX N=$N " for N in [1 , 2 , 3 , 4 , 5 , 15 , 20 ]
10
- for i in 1 : N
11
- st = rand (Float64, 1 << N);
12
- locs = BQCESubroutine. Locations (i);
13
- st0 = broutine! (copy (st), Val (:X ), locs);
14
- st1 = broutine! (copy (st), [0 1 ; 1 0 ], locs);
15
- @test st0 ≈ st1
16
- end
17
- end ;
9
+ @testset " nthreads=$(Threads. nthreads ()) " begin
10
+ @testset " BX N=$N " for N in [1 : 10 ... , 15 , 20 ]
11
+ for i in 1 : N
12
+ st = rand (Float64, 1 << N);
13
+ locs = BQCESubroutine. Locations (i);
14
+ st0 = broutine! (copy (st), Val (:X ), locs);
15
+ st1 = broutine! (copy (st), [0 1 ; 1 0 ], locs);
16
+ @test st0 ≈ st1
17
+ end
18
+ end ;
18
19
19
- @testset " BPSWAP N=$N " for N in [2 , 3 , 4 , 5 , 15 , 20 ]
20
- for i in 1 : N, j in i+ 1 : N
21
- st = rand (ComplexF64, 1 << N);
22
- locs = BQCESubroutine. Locations ([i, j]);
23
- θ = 2 π * rand ();
24
- st0 = broutine! (copy (st), Val (:PSWAP ), locs, θ);
25
- st1 = broutine! (copy (st), BQCESubroutine. BPSWAP (θ), locs);
26
- # println("N=$N, i=$i, j=$j, |err|=", norm(st0-st1))
27
- @test st0 ≈ st1
28
- end
29
- end ;
20
+ @testset " BPSWAP N=$N " for N in [2 : 10 ... , 15 , 20 ]
21
+ for i in 1 : N, j in i+ 1 : N
22
+ st = rand (ComplexF64, 1 << N);
23
+ locs = BQCESubroutine. Locations ([i, j]);
24
+ θ = 2 π * rand ();
25
+ st0 = broutine! (copy (st), Val (:PSWAP ), locs, θ);
26
+ st1 = broutine! (copy (st), BQCESubroutine. BPSWAP (θ), locs);
27
+ # println("N=$N, i=$i, j=$j, |err|=", norm(st0-st1))
28
+ @test st0 ≈ st1
29
+ end
30
+ end ;
31
+ end ;
0 commit comments