Skip to content

Commit

Permalink
Fix mutation on conj, adjoint (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing authored Sep 6, 2024
1 parent a2979b5 commit 03d2627
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Quantum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ end
Returns the adjoint of a [`Quantum`](@ref) Tensor Network; i.e. the conjugate Tensor Network with the inputs and outputs swapped.
"""
Base.adjoint(tn::AbstractQuantum) = adjoint!(copy(tn))
Base.adjoint(tn::AbstractQuantum) = adjoint!(deepcopy(tn))

function LinearAlgebra.adjoint!(tn::AbstractQuantum)
conj!(tn)
Expand Down
2 changes: 1 addition & 1 deletion src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Base.size(tn::AbstractTensorNetwork, args...) = size(TensorNetwork(tn), args...)

Base.eltype(tn::AbstractTensorNetwork) = promote_type(eltype.(tensors(tn))...)

Base.conj(tn::AbstractTensorNetwork) = conj!(copy(tn))
Base.conj(tn::AbstractTensorNetwork) = conj!(deepcopy(tn))
function Base.conj!(tn::AbstractTensorNetwork)
foreach(conj!, tensors(tn))
return tn
Expand Down

0 comments on commit 03d2627

Please sign in to comment.