Skip to content

Commit

Permalink
Generalize addsite!,rmsite! to AbstractQuantum
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Sep 4, 2024
1 parent 5d3ff97 commit 376e59c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Quantum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function LinearAlgebra.adjoint!(tn::AbstractQuantum)
return tn
end

addsite!(tn::AbstractQuantum, site, index) = addsite!(Quantum(tn), site, index)
function addsite!(tn::Quantum, site, index)
if haskey(tn.sites, site)
error("Site $site already exists")
Expand All @@ -221,6 +222,7 @@ function addsite!(tn::Quantum, site, index)
return tn.sites[site] = index
end

rmsite!(tn::AbstractQuantum, site) = rmsite!(Quantum(tn), site)
function rmsite!(tn::Quantum, site)
if !haskey(tn.sites, site)
error("Site $site does not exist")
Expand Down

0 comments on commit 376e59c

Please sign in to comment.