Skip to content

Commit

Permalink
Minor improvement of code.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed Sep 20, 2023
1 parent 35264d2 commit e97e411
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/QuantumSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ Judge whether an operator is normal ordered.
function isnormalordered(opt::Operator{<:Number, <:ID{AbstractCompositeIndex{<:Index{Int, <:FID}}}})
flag = true
for i = 1:rank(opt)
flag && (opt.id[i].index.iid.nambu == annihilation) && (flag = false)
flag || (opt.id[i].index.iid.nambu == creation) && return false
flag && (opt[i].index.iid.nambu == annihilation) && (flag = false)
flag || (opt[i].index.iid.nambu == creation) && return false
end
return true
end
Expand All @@ -218,7 +218,7 @@ end
Get the multiplication of two fermionic Fock operators.
"""
const block = quote
rank(f₁)>0 && rank(f₂)>0 && f₁.id[end]==f₂.id[1] && return 0
rank(f₁)>0 && rank(f₂)>0 && f₁[end]==f₂[1] && return 0
return invoke(*, Tuple{OperatorProd, OperatorProd}, f₁, f₂)
end
@eval @inline Base.:*(f₁::Operator{<:Number, <:ID{FID{:f}}}, f₂::Operator{<:Number, <:ID{FID{:f}}}) = $block
Expand Down

0 comments on commit e97e411

Please sign in to comment.