Skip to content

Commit

Permalink
Implement inds for getting physical and virtual indices subsets
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Aug 14, 2024
1 parent 9467998 commit 10b5f10
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Quantum.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using KeywordDispatch

"""
AbstractQuantum
Expand Down Expand Up @@ -174,6 +176,15 @@ function Base.show(io::IO, q::Quantum)
end

@kwmethod inds(tn::AbstractQuantum; at) = Quantum(tn).sites[at]
@kwmethod function inds(tn::AbstractQuantum; set)
if set === :physical
return values(Quantum(tn).sites)
elseif set === :virtual
return setdiff(inds(tn), values(Quantum(tn).sites))
else
return inds(TensorNetwork(tn); set)
end
end

"""
adjoint(q::Quantum)
Expand Down

0 comments on commit 10b5f10

Please sign in to comment.