Skip to content

Commit

Permalink
Apply @mofeing suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Sánchez Ramírez <[email protected]>
  • Loading branch information
jofrevalles and mofeing authored Jul 4, 2023
1 parent c564093 commit 0c47ab2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,16 @@ function transform!(tn::TensorNetwork, config::SplitSimplification)
for tensor in tensor_list
inds = labels(tensor)

partitions = Iterators.flatten(combinations(inds, r) for r = 1:(length(inds)-1))

# Iterate over all possible bipartitions of the tensor's indices
for bipartition in partitions
# iterate all bipartitions of the tensor's indices
bipartitions = Iterators.flatten(combinations(inds, r) for r = 1:(length(inds)-1))
for bipartition in bipartitions
left_inds = collect(bipartition)
right_inds = setdiff(inds, left_inds)

# Perform an SVD across the bipartition
# perform an SVD across the bipartition
u, s, v = svd(tensor; left_inds=left_inds)

# Get the singular values and decide the rank
singular_values = diag(s)
rank_s = sum(singular_values .> config.atol)
rank_s = sum(diag(s) .> config.atol)

if rank_s < length(singular_values)
# Remove unnecessary data in u, s, v
Expand Down

0 comments on commit 0c47ab2

Please sign in to comment.