Skip to content

Commit

Permalink
Fix isapprox on TensorNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Sep 13, 2024
1 parent 2064d18 commit 72ea6d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ function Base.show(io::IO, tn::T) where {T<:AbstractTensorNetwork}
end

Base.:(==)(a::AbstractTensorNetwork, b::AbstractTensorNetwork) = all(splat(==), zip(tensors(a), tensors(b)))
Base.isapprox(a::AbstractTensorNetwork, b::AbstractTensorNetwork) = all(splat(isapprox), zip(tensors(a), tensors(b)))
function Base.isapprox(a::AbstractTensorNetwork, b::AbstractTensorNetwork; kwargs...)
return all(((x, y),) -> isapprox(x, y; kwargs...), zip(tensors(a), tensors(b)))
end

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

Expand Down

0 comments on commit 72ea6d6

Please sign in to comment.