@@ -3,7 +3,11 @@ using WignerSymbols
3
3
using LinearAlgebra
4
4
using Random
5
5
using Base. Threads
6
- N = Base. Threads. nthreads ()
6
+ if Base. Sys. iswindows () # not sure why the multithreaded version fails on Windows
7
+ N = 1
8
+ else
9
+ N = Base. Threads. nthreads ()
10
+ end
7
11
Random. seed! (1234 )
8
12
9
13
smalljlist = 0 : 1 // 2 : 10
51
55
end
52
56
53
57
# test recurrence relations: Phys Rev E 57, 7274 (1998)
54
- if Base . Sys . iswindows () # not sure why the multithreaded version fails on Windows
55
- @testset " wigner3j: recurrence relations" begin
56
- for k = 1 : 8
58
+ @threads for i = 1 : N
59
+ @testset " wigner3j: recurrence relations, thread $i " begin
60
+ for k = 1 : div ( 8 ,N)
57
61
j2 = convert (BigFloat, rand (largejlist))
58
62
j3 = convert (BigFloat, rand (largejlist))
59
63
m2 = - convert (BigFloat, rand (- j2: 0 ))
@@ -70,27 +74,6 @@ if Base.Sys.iswindows() # not sure why the multithreaded version fails on Window
70
74
end
71
75
end
72
76
end
73
- else
74
- @threads for i = 1 : N
75
- @testset " wigner3j: recurrence relations, thread $i " begin
76
- for k = 1 : div (8 ,N)
77
- j2 = convert (BigFloat, rand (largejlist))
78
- j3 = convert (BigFloat, rand (largejlist))
79
- m2 = - convert (BigFloat, rand (- j2: 0 ))
80
- m3 = convert (BigFloat, rand (- j3: 0 ))
81
-
82
- for j in max (abs (j2- j3),abs (m2+ m3))+ 1 : (j2+ j3)- 1
83
- X = j* sqrt (((j+ 1 )^ 2 - (j2- j3)^ 2 )* ((j2+ j3+ 1 )^ 2 - (j+ 1 )^ 2 )* ((j+ 1 )^ 2 - (m2+ m3)^ 2 ))
84
- Y = (2 * j+ 1 )* ((m2+ m3)* (j2* (j2+ 1 )- j3* (j3+ 1 )) - (m2- m3)* j* (j+ 1 ))
85
- Z = (j+ 1 )* sqrt ((j^ 2 - (j2- j3)^ 2 )* ((j2+ j3+ 1 )^ 2 - j^ 2 )* (j^ 2 - (m2+ m3)^ 2 ))
86
- tol = 10 * max (abs (X),abs (Y),abs (Z))* eps (BigFloat)
87
- @test (X* wigner3j (BigFloat,j+ 1 ,j2,j3,- m2- m3,m2,m3) +
88
- Z* wigner3j (BigFloat,j- 1 ,j2,j3,- m2- m3,m2,m3)) ≈
89
- (- Y* wigner3j (BigFloat,j,j2,j3,- m2- m3,m2,m3)) atol= tol
90
- end
91
- end
92
- end
93
- end
94
77
end
95
78
96
79
@threads for i = 1 : N
0 commit comments