Skip to content

Remove explicit call to InfiniteMPS in VUMPS and IDMRG#396

Open
AFeuerpfeil wants to merge 10 commits intoQuantumKitHub:mainfrom
AFeuerpfeil:pr-styles-vumps
Open

Remove explicit call to InfiniteMPS in VUMPS and IDMRG#396
AFeuerpfeil wants to merge 10 commits intoQuantumKitHub:mainfrom
AFeuerpfeil:pr-styles-vumps

Conversation

@AFeuerpfeil
Copy link
Contributor

I remove the call to InfiniteMPS to typeof(mps). This change necessitates that typeof(mps) supports the same interface for the constructor of an InfiniteMPS.

I also removed the call to it.state.mps.AR[1:end], as calling the indexing [1:end] might remove information about the Vector type of AR.

Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I left a small comment on the implementation here, I think I would be happier with a more fundamental change where instead of the uniform gauge happening in the InfiniteMPS constructor, we actually use the dedicated function:
Something along the lines of:

gaugefix!(similar(it.state.mps), copy(it.state.AR), ...; kwargs...)


alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ)
ψ′ = InfiniteMPS(it.state.mps.AR[1:end]; alg_gauge.tol, alg_gauge.maxiter)
ψ′ = typeof(mps)(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ψ′ = typeof(mps)(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter)
ψ′ = typeof(mps)(copy(it.state.mps.AR); alg_gauge.tol, alg_gauge.maxiter)

Otherwise this will share the array with the input, which is probably not what we want here.
This being said, I think if you overload similar for your array type it keeps its type.

@AFeuerpfeil
Copy link
Contributor Author

Thanks for the recommendation!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Your PR no longer requires formatting changes. Thank you for your contribution!

@lkdvos
Copy link
Member

lkdvos commented Mar 2, 2026

Looks like the similar call is actually not sufficient as that does not allocate any of the tensors, I think copy is probably enough to fix this

@lkdvos lkdvos enabled auto-merge (squash) March 2, 2026 14:02
auto-merge was automatically disabled March 2, 2026 18:12

Head branch was pushed to by a user without write access

@lkdvos
Copy link
Member

lkdvos commented Mar 3, 2026

Just looked at this a bit more - the IDMRG2 failures are most likely because the spaces of the MPS are changing, so my proposed solution in terms of an in-place function doesn't work that straightforwardly, since gaugefix! really does assume all tensors are the correct sizes. I'm not entirely sure if there is an easy way around this, as we were using the constructor as a trick to bring the MPS tensors back into a compatible form after the IDMRG which is allowed to change it...

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.

2 participants