Skip to content

Commit

Permalink
Add check in TensorNetwork constructor for inconsistent dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jofrevalles committed Jul 12, 2023
1 parent 6f21d05 commit 71506a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ struct TensorNetwork{A<:Ansatz,M<:NamedTuple}
mergewith(vcat, dict, Dict([index => [i] for index in labels(tensor)]))
end

# Check for inconsistent dimensions
for (index, idxs) in indices
sizes = [size(tensors[i], index) for i in idxs]
if !all(x -> x == sizes[1], sizes)
throw(DimensionMismatch("Different sizes specified for index $index"))
end
end

M = Tenet.metadata(A)
metadata = M((; metadata...))

Expand Down

0 comments on commit 71506a5

Please sign in to comment.