Skip to content

Commit

Permalink
add partial trace to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms committed Jun 7, 2024
1 parent 8890926 commit f088294
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ shift
clock
gell_mann
gell_mann!
partial_trace
cleanup!
```

Expand Down Expand Up @@ -76,4 +77,6 @@ anti_isotropic
```@docs
Ket._partition
Ket._fiducial_WH
Ket._idx
Ket._tidx
```
10 changes: 7 additions & 3 deletions src/partial_tra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function _idx(tidx::Vector{<:Integer}, dims::Vector{<:Integer})
end

"""
partial_trace(X::AbstractMatrix, remove::AbstractVector, dims::
AbstractVector)
partial_trace(X::AbstractMatrix, remove::Vector, dims::Vector)
Takes the partial trace of matrix `X` with subsystem dimensions `dims` over the subsystems in `remove`.
"""
Expand Down Expand Up @@ -93,5 +92,10 @@ function partial_trace(X::AbstractMatrix{T}, remove::Vector{<:Integer}, dims::Ve
end
return Y
end
partial_trace(X::AbstractMatrix, sys::Integer, dims::Vector{<:Integer}) = partial_trace(X, [sys], dims)
"""
partial_trace(X::AbstractMatrix, remove::Integer, dims::Vector)
Takes the partial trace of matrix `X` with subsystem dimensions `dims` over the subsystem `remove`.
"""
partial_trace(X::AbstractMatrix, remove::Integer, dims::Vector{<:Integer}) = partial_trace(X, [remove], dims)
export partial_trace

0 comments on commit f088294

Please sign in to comment.