Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 9j symbols. #17

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
convert 9j cached binomial return to BigInt. Increase 9j testing size.
tgorordo committed Aug 15, 2024
commit 1c2727f32a85d6fff55ba879ad0bd9d1f0ce113e
4 changes: 2 additions & 2 deletions src/WignerSymbols.jl
Original file line number Diff line number Diff line change
@@ -489,12 +489,12 @@ end
bcache = LRU{Tuple{BigInt, BigInt}, BigInt}(; maxsize=10^6)
function cbinomial(n::BigInt, k::BigInt)
if k == 0
return 1 // big(1)
return big(1)
end # guard
if haskey(bcache, (n, k))
return bcache[(n, k)]
else
res = ((n + 1 - k) // k) * cbinomial(n, k - 1)
res = convert(BigInt, cbinomial(n, k - 1) * (n + 1 - k) // k)
bcache[(n, k)] = res
return res
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ end

@threads for i = 1:N
@testset "wigner9j: relation to sum over 6j products, thread $i" begin
for k = 1:1000
for k = 1:10_000
@testset let (j1, j2, j3, j4, j5, j6, j7, j8, j9) = rand(smalljlist, 9)
@test wigner9j(j1, j2, j3,
j4, j5, j6,