Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behavior of factorize mindim #1214

Merged
merged 5 commits into from
Oct 19, 2023
Merged

Fix behavior of factorize mindim #1214

merged 5 commits into from
Oct 19, 2023

Conversation

ryanlevy
Copy link
Contributor

@ryanlevy ryanlevy commented Oct 18, 2023

Description

Fixes #1207

Minimal demonstration of previous behavior

Quick update, a more minimal example. Say we have a two-site tensor that we want to factorize

s  = Index(2)
s′ = Index(2)
l = Index(64)
r = Index(16)
T = randomITensor(l,s,s′,r)

The inconsistent behavior manifests as

> L,R,spec = factorize(T,l,s; cutoff=0,mindim=64)
> @show inds(L)
inds(L) = ((dim=64|id=719), (dim=2|id=499), (dim=32|id=847|"Link,fact"))

where we get the 64->32->16 stepdown. Or with cutoff

> L,R,spec = factorize(T,l,s; cutoff=1e-10,mindim=64)
> @show inds(L)
inds(L) = ((dim=64|id=444), (dim=2|id=941), (dim=64|id=961|"Link,fact"))

Where the factorize respects the mindim by padding the link dimension. I think the cutoff=0 behavior is best here.

Minimal demonstration of new behavior

using ITensors

s  = Index(2)
s′ = Index(2)
l = Index(64)
r = Index(16)
T = randomITensor(l,s,s′,r)

L,R,spec = factorize(T,l,s; cutoff=1e-10,maxdim=64,mindim=64)
@show inds(L)
@show inds(R)
> inds(L) = ((dim=64|id=96), (dim=2|id=968), (dim=32|id=502|"Link,fact"))
> inds(R) = ((dim=32|id=502|"Link,fact"), (dim=2|id=814), (dim=16|id=189))

How Has This Been Tested?

No new tests

Checklist:

  • My code follows the style guidelines of this project. Please run using JuliaFormatter; format(".") in the base directory of the repository (~/.julia/dev/ITensors) to format your code according to our style guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that verify the behavior of the changes I made.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b5d963e) 85.38% compared to head (d5f3168) 67.36%.
Report is 2 commits behind head on main.

❗ Current head d5f3168 differs from pull request most recent head 182e412. Consider uploading reports for the commit 182e412 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1214       +/-   ##
===========================================
- Coverage   85.38%   67.36%   -18.02%     
===========================================
  Files          89       88        -1     
  Lines        8427     8392       -35     
===========================================
- Hits         7195     5653     -1542     
- Misses       1232     2739     +1507     
Files Coverage Δ
src/tensor_operations/matrix_decomposition.jl 91.63% <100.00%> (-0.62%) ⬇️

... and 35 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ryanlevy and others added 2 commits October 18, 2023 16:56
Co-authored-by: Matt Fishman <mtfishman@users.noreply.github.com>
@mtfishman
Copy link
Member

Thanks Ryan, could you add a test?

ryanlevy and others added 2 commits October 19, 2023 14:23
Co-authored-by: Matt Fishman <mtfishman@users.noreply.github.com>
@mtfishman
Copy link
Member

Thanks!

@mtfishman mtfishman merged commit d4df519 into ITensor:main Oct 19, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ITensors] [BUG] Inconsistent Behavior of mindim
3 participants