Skip to content

Commit

Permalink
remove numeri requirements from ptrace, ptranspose and reshuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed May 4, 2021
1 parent e24a5ac commit a213dd3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/ptrace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $(SIGNATURES)
Return [partial trace](https://en.wikipedia.org/wiki/Partial_trace) of matrix `ρ` over the subsystems determined by `isystems`.
"""
function ptrace::AbstractMatrix{<:Number}, idims::Vector{Int}, isystems::Vector{Int})
function ptrace::AbstractMatrix, idims::Vector{Int}, isystems::Vector{Int})
dims = reverse(idims)
systems = length(idims) .- isystems .+ 1

Expand Down Expand Up @@ -38,15 +38,15 @@ $(SIGNATURES)
- `idims`: dimensins of subsystems.
- `sys`: traced subsystem.
"""
ptrace::AbstractMatrix{<:Number}, idims::Vector{Int}, sys::Int) = ptrace(ρ, idims, [sys])
ptrace::AbstractMatrix, idims::Vector{Int}, sys::Int) = ptrace(ρ, idims, [sys])

"""
$(SIGNATURES)
- `ψ`: quantum state pure state (ket).
- `idims`: dimensins of subsystems - only bipartite states accepted.
- `sys`: traced subsystem.
"""
function ptrace::AbstractVector{<:Number}, idims::Vector{Int}, sys::Int)
function ptrace::AbstractVector, idims::Vector{Int}, sys::Int)
# TODO : Allow mutlipartite systems
length(idims) == 2 ? () : throw(ArgumentError("idims has to be of length 2"))
_, cols = idims
Expand Down
4 changes: 2 additions & 2 deletions src/ptranspose.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $(SIGNATURES)
Return [partial transposition](http://en.wikipedia.org/wiki/Peres-Horodecki_criterion) of matrix `ρ` over the subsystems determined by `isystems`.
"""
function ptranspose::AbstractMatrix{<:Number}, idims::Vector{Int}, isystems::Vector{Int})
function ptranspose::AbstractMatrix, idims::Vector{Int}, isystems::Vector{Int})
dims = reverse(idims)
systems = length(idims) .- isystems .+ 1

Expand Down Expand Up @@ -39,7 +39,7 @@ $(SIGNATURES)
- `idims`: dimensins of subsystems.
- `sys`: transposed subsystem.
"""
ptranspose::AbstractMatrix{<:Number}, idims::Vector{Int}, sys::Int) = ptranspose(ρ, idims, [sys])
ptranspose::AbstractMatrix, idims::Vector{Int}, sys::Int) = ptranspose(ρ, idims, [sys])

function _ptranspose::AbstractMatrix{<:Number}, idims::Vector{Int}, isystems::Vector{Int})
ns = length(idims)
Expand Down
4 changes: 2 additions & 2 deletions src/reshuffle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export reshuffle
# Given multiindexed matrix M_{(m,μ),(n,ν)} it returns
# matrix M_{(m,n),(μ,ν)}.
# """
function reshuffle::AbstractMatrix{<:Number}, dims::Matrix{Int})
function reshuffle::AbstractMatrix, dims::Matrix{Int})
m, n, μ, ν = dims
tensor = reshape(ρ, μ, m, ν, n)
perm = [4, 2, 3, 1]
Expand All @@ -20,7 +20,7 @@ end
Given multiindexed matrix \$M_{(m,μ),(n,ν)}\$ it returns
matrix \$M_{(m,n),(μ,ν)}\$.
"""
function reshuffle::AbstractMatrix{<:Number})
function reshuffle::AbstractMatrix)
(r, c) = size(ρ)
sqrtr = isqrt(r)
sqrtc = isqrt(c)
Expand Down

0 comments on commit a213dd3

Please sign in to comment.