Skip to content

Commit

Permalink
special case num_singly_doubly_occupied_sites
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimbrand committed Feb 9, 2024
1 parent 2414aad commit 676f352
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Hamiltonians/HubbardMom1D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ function num_singly_doubly_occupied_sites(b::SingleComponentFockAddress)
return singlies, doublies
end

# faster method for this special case
function num_singly_doubly_occupied_sites(b::OccupationNumberFS)
return num_singly_doubly_occupied_sites(onr(b))
end

function num_singly_doubly_occupied_sites(onrep::AbstractArray)
# this one is faster by about a factor of 2 if you already have the onrep
# returns number of singly and doubly occupied sites
Expand Down

0 comments on commit 676f352

Please sign in to comment.