Skip to content

Conversation

@ogauthe
Copy link
Contributor

@ogauthe ogauthe commented Sep 23, 2025

This is a work in progress to add a randomized projector that uses randomized SVD. It imposes fullinfinite environment (it is also possible to define it for halfinfinite, but there should be little performance gain while loosing accuracy so I think it is not worth it).

The logic is

  • do not contract the full environment: keep a lazy struct FourQuadrants
  • for each matrix block, if its size is below max_full, compute SVD of full block
  • if matrix block size is above max_full, compute a random range for n + oversampling value, where n is the number of values kept in previous iterations
  • proceed with n_subspace_iter iterations to improve range accuracy and get faster decaying singular spectrum.

The point is to reuse information from previous iteration to predict each sector size. The same logic may be used for a Kyrlov implementation too. Currently, max_full, n_subspace_iter and oversampling are fixed (I had issues with leading_boundary interface).

The implementations follows https://gregorygundersen.com/blog/2019/01/17/randomized-svd/, which is a nice explanation of Halko et al's 2011 paper. I also took inspirations from https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html#rf38c2b656ebc-1 for the details of the subspace iterations.

The performances are impressive. The accuracy is worse than the full case and more iterations are needed, but it still converges (need to benchmark harder cases) and the total time is lower. I still need to benchmark with Krylov projector.

TODO:

  • polish interface
  • define max_full and other parameters as true defaults and allow to set them
  • factorize loop over randomized sectors
  • test compatibility with Zygote
  • add tests

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 9.87654% with 73 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/ctmrg/projectors.jl 4.16% 46 Missing ⚠️
src/algorithms/ctmrg/simultaneous.jl 26.66% 11 Missing ⚠️
src/algorithms/contractions/ctmrg_contractions.jl 0.00% 8 Missing ⚠️
src/environments/ctmrg_environments.jl 0.00% 8 Missing ⚠️
Files with missing lines Coverage Δ
src/PEPSKit.jl 100.00% <ø> (ø)
src/algorithms/ctmrg/sequential.jl 98.41% <100.00%> (ø)
src/algorithms/contractions/ctmrg_contractions.jl 50.09% <0.00%> (-0.80%) ⬇️
src/environments/ctmrg_environments.jl 76.87% <0.00%> (-3.73%) ⬇️
src/algorithms/ctmrg/simultaneous.jl 86.41% <26.66%> (-13.59%) ⬇️
src/algorithms/ctmrg/projectors.jl 44.44% <4.16%> (-38.58%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant