Skip to content

Commit

Permalink
Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
aryavorskiy committed Apr 15, 2024
1 parent 7a28e0e commit 2a4d7fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/manybody.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ Base.similar(occ::OccupationNumbers, ::Type{T}, dims::Dims) where {T} =
OccupationNumbers(occ.statistics, similar(occ.occupations, T, dims))
Base.similar(::Type{OccupationNumbers{StatisticsT,T}}, dims::Dims) where {StatisticsT,T} =
OccupationNumbers(StatisticsT(), similar(Vector{T}, dims))
Base.isless(occ1::OccupationNumbers, occ2::OccupationNumbers) = occ1.occupations < occ2.occupations
Base.copyto!(dest::OccupationNumbers, src::OccupationNumbers) = copyto!(dest.occupations, src.occupations)
Base.convert(::Type{OccupationNumbers{StatisticsT,T}}, occ::AbstractVector) where {StatisticsT,T} =
OccupationNumbers(StatisticsT(), convert(Vector{T}, occ))

Expand All @@ -368,6 +370,7 @@ struct BosonStatistics end

Base.@propagate_inbounds function state_transition!(buffer, occ::OccupationNumbers{BosonStatistics},
at_indices, a_indices)
any(==(0), (occ[m] for m in a_indices)) && return nothing
factor_sq = 1
copyto!(buffer, occ)
for i in a_indices
Expand All @@ -384,6 +387,7 @@ end

Base.@propagate_inbounds function state_transition!(buffer, occ::OccupationNumbers{FermionStatistics},
at_indices, a_indices)
any(==(0), (occ[m] for m in a_indices)) && return nothing
factor = 1
copyto!(buffer, occ)
for i in a_indices
Expand Down

0 comments on commit 2a4d7fc

Please sign in to comment.