Optimize Moshinsky matrix construction

This commit is contained in:
Nuwan Yapa 2024-04-19 17:18:36 -04:00
parent 4fae06f8cd
commit 9675e4a47e
1 changed files with 3 additions and 3 deletions

View File

@ -99,10 +99,10 @@ function Moshinsky_transform(Es, n1s, l1s, n2s, l2s, Λ)
@ccall "../OSBRACKETS/allosbrac.so".allosbrac_(NQMAX::Ref{Int32},LMIN::Ref{Int32},LMAX::Ref{Int32},CO::Ref{Float64},SI::Ref{Float64},BRACs[parity]::Ptr{Array{Float64}})::Cvoid
end
mat = spzeros(length(Es), length(Es))
mat = zeros(length(Es), length(Es))
s = hcat(Es, n1s, l1s, n2s, l2s)
for idx in CartesianIndices(mat)
Threads.@threads for idx in CartesianIndices(mat)
(i, j) = Tuple(idx)
(Elhs, N, L, n, l) = s[i, :]
(Erhs, n1, l1, n2, l2) = s[j, :]
@ -112,7 +112,7 @@ function Moshinsky_transform(Es, n1s, l1s, n2s, l2s, Λ)
end
end
return mat
return sparse(mat)
end
function pick_Moshinsky_brakcet(BRAC, n1, l1, n2, l2, n1, l1, n2, l2, Λ) # Efros notation -- don't confuse