mirror of
https://github.com/tgorordo/WignerSymbols.jl.git
synced 2026-06-05 15:42:15 -07:00
Enable precompilation
This commit is contained in:
parent
a05b93dc48
commit
dd75309fe6
3 changed files with 14 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
__precompile__(false)
|
||||
__precompile__(true)
|
||||
module WignerSymbols
|
||||
export δ, Δ, clebschgordan, wigner3j, wigner6j, racahV, racahW
|
||||
|
||||
|
|
@ -7,6 +7,16 @@ include("primefactorization.jl")
|
|||
const Wigner3j = Dict{Tuple{UInt,UInt,UInt,Int,Int},Tuple{Rational{BigInt},Rational{BigInt}}}()
|
||||
const Wigner6j = Dict{NTuple{6,UInt},Tuple{Rational{BigInt},Rational{BigInt}}}()
|
||||
|
||||
function __init__()
|
||||
global bigone, bigprimetable, Wigner3j, Wigner6j
|
||||
bigone[] = big(1)
|
||||
bigprimetable[1][1] = big(2)
|
||||
bigprimetable[2][1] = big(3)
|
||||
bigprimetable[3][1] = big(5)
|
||||
Base.rehash!(Wigner3j)
|
||||
Base.rehash!(Wigner6j)
|
||||
end
|
||||
|
||||
# check integerness and correctness of (j,m) angular momentum
|
||||
ϵ(j, m) = (abs(m) <= j && isinteger(j-m) && isinteger(j+m))
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const primetable = [2,3,5]
|
|||
const factortable = [UInt8[], UInt8[1], UInt8[0,1], UInt8[2], UInt8[0,0,1]]
|
||||
const factorialtable = [UInt32[], UInt32[], UInt32[1], UInt32[1,1], UInt32[3,1], UInt32[3,1,1]]
|
||||
const bigprimetable = [[big(2)], [big(3)], [big(5)]]
|
||||
const bigone = Ref{BigInt}(big(1))
|
||||
|
||||
# Make a prime iterator
|
||||
struct PrimeIterator
|
||||
|
|
@ -42,9 +43,8 @@ Base.next(::PrimeIterator, n) = prime(n), n+1
|
|||
Base.done(::PrimeIterator, n) = false
|
||||
|
||||
# get primes and their powers as `BigInt`, also cache all results
|
||||
const bigone = big(1)
|
||||
function bigprime(n::Integer, e::Integer=1)
|
||||
e == 0 && return bigone
|
||||
e == 0 && return bigone[]
|
||||
p = prime(n) # triggers computation of prime(n) if necessary
|
||||
@inbounds l = length(bigprimetable[n])
|
||||
@inbounds while l < e
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ end
|
|||
J12range = max(abs(j1-j2),abs(J-j3)):min((j1+j2),(J+j3))
|
||||
J23range = max(abs(j2-j3),abs(j1-J)):min((j2+j3),(j1+J))
|
||||
for J12 in J12range, J23 in J23range
|
||||
M = J # only test for J, should be independent
|
||||
M = rand(-J:J) # only test for one instance of M in -J:J, should be independent of M anyway
|
||||
fill!(V1,0)
|
||||
fill!(V2,0)
|
||||
for (k1,m1) in enumerate(m1range)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue