Skip to content

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Oct 30, 2025

I have for a long time wanted to change the way our mps are constructed, and I finally started to have a first go at the idea I had in mind.
Disclaimer: everything is up for debate, including names and functionality.

The main idea is that I want to mimic what Base and TensorKit do for their constructors, which basically boils down to having

rand([T], structure) -> output

In order to achieve this, I therefore added some structure to dispatch on, which I tentatively named MPSManifold.
This is just a glorified collection of all of the spaces, but I would argue that it nicely organizes a bit more of the logic surrounding spaces away from the logic concerning the actual constructors.
The updated workflow would now be:

manifold = FiniteMPSManifold(pspaces, vspaces)
mps = rand(Float64, manifold)

I like that it separates out some code logic, especially surrounding the "full-rank-ness" of MPS, and I like the syntax, and I love that we no longer have a million weird constructors that would have to be supported, but before I go in and update the docs, and do the same for the InfiniteMPS, I would like some feedback.
Does this make sense? Is it too convoluted? Do you think it is an improvement?

It would be fairly straightforward to add various utility functions to this interface as well, such as vcat, repeat, ...

@lkdvos lkdvos self-assigned this Oct 30, 2025
@VictorVanthilt
Copy link
Member

I'm definitely in favor of streamlining the way (in)finiteMPS objects are created. I also like the idea of making it very similar to other construction methods in the ecosystem like rand(scalartype, abstractwhateverspace). I do like the fact that there are a multitude of ways to create an MPS at the moment, like giving a physical dimension, max virtual dim. and a length for example. These are all very easy to parse into the standard FiniteMPSManifold form though.

On a related note:
Creating a specific state instead of just a random one is too complicated at the moment in my opinion.
Oftentimes I want to start my simulation from some computational basis state, or from another simple product state and making this by hand is rather cumbersome. Some functionality to make some simple states instead of just random ones would be something i'd like very much and would definitely want to help with.

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 76.34855% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/states/abstractmps.jl 70.07% 38 Missing ⚠️
src/states/infinitemps.jl 80.39% 10 Missing ⚠️
src/states/finitemps.jl 85.71% 9 Missing ⚠️
Files with missing lines Coverage Δ
src/states/finitemps.jl 81.27% <85.71%> (-12.96%) ⬇️
src/states/infinitemps.jl 57.46% <80.39%> (-18.84%) ⬇️
src/states/abstractmps.jl 63.90% <70.07%> (+0.37%) ⬆️

... and 75 files with indirect coverage changes

🚀 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.

3 participants