Skip to content

Implemeting TTI-PTs#158

Open
emile-cochin wants to merge 33 commits intotempoCollaboration:mainfrom
emile-cochin:iTEBD
Open

Implemeting TTI-PTs#158
emile-cochin wants to merge 33 commits intotempoCollaboration:mainfrom
emile-cochin:iTEBD

Conversation

@emile-cochin
Copy link
Copy Markdown

Summary

Pull request for implementing time-translationally invariant process tensors (TTI-PTs) into OQuPy, as agreed in #155.

Pull Request Check List

This checklist serves as a guide for contributors and maintainers to assess
whether a contribution can be merged into the main branch and thus serves
to guarantee the quality of the package. Please read the
contribution guideline.

Before you submit a pull request, please go through this checklist once
more, as it will decrease the number of unnecessary review cycles.
However, this list is there to help all contributors to produce high
quality code, not to deter you from contributing. If you can't tick some of the
boxes, feel free to submit the pull request anyway and report about it in the
pull request message. Also, some of the boxes might not apply to the specific
type of your contribution.

  • The contribution has been discussed and agreed on in the Issue section.
  • Code contributions do its best to follow the zen of python.
  • The automated test are all positive:
    • tox -e py36 (to run pytest) the code tests.
    • tox -e style (to run pylint) the code style tests.
  • Added test for changed/added code.
  • The documentation has been updated:
    • docstring for all new functions/methods/classes/modules.
    • consistent style of all docstrings.
    • for new modules: /docs/pages/modules.rst has been updated.
    • for new functionality: /docs/pages/api.rst has been updated.
    • for new functionality: tutorials and examples have been updated.

@gefux gefux self-assigned this Feb 23, 2026
@gefux gefux added the enhancement New feature or request label Feb 23, 2026
paulreastham and others added 28 commits March 2, 2026 00:23
…of time dependent Hamiltonian to iTEBD-example
Modified example to use this capability.
@gefux
Copy link
Copy Markdown
Member

gefux commented Mar 1, 2026

Hi @emile-cochin! Thank you for submitting this pull request and sorry for the delayed reply. Because several of the changes that need to be made are of a type that is easier for me to quickly carry out rather then explain, I'd like to continue my go-over this code myself before we start code review together. I'll get back to you sometime this week. Best -- gefux

@gefux gefux self-requested a review March 6, 2026 10:32
Copy link
Copy Markdown
Member

@gefux gefux left a comment

Choose a reason for hiding this comment

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

Hi @emile-cochin. Thank you for this.
I made some comments with suggestions for the core functionality.
Beside this there are a few other topics, which we'll maybe resolve in another round of review later, but I mention here for completness:

  • Create coverage test
  • Create physics tests
  • Create a tutorial
  • Fix code style (linter)
  • [Optional] some performance testing

Comment thread oqupy/backends/itebd_tempo.py Outdated
Comment thread oqupy/backends/itebd_tempo.py Outdated
Comment thread oqupy/backends/itebd_tempo.py Outdated
Comment thread oqupy/process_tensor.py
return self._dt

@property
def max_step(self) -> Union[int, float]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am makeing a comment on the Process Tensor classes in the #155 issue thread.

Comment thread oqupy/backends/itebd_tempo.py Outdated
Comment thread oqupy/backends/itebd_tempo.py Outdated
…-PT backend

* Added the specialization between `SimpleProcessTensorFinite` and
`SimpleProcessTensorInfinite` (one has a `None` `repeating_cell` and the
other has a tuple describing the starting index and length of the
repeating cell).
* Added a `rank` parameter to `TempoParameters` to truncate the SVD (for
now only used by the `TTITempo` backend).
* Rewrote the `TTITempo` backend to match the `PtTempo` style.
* Added support for infinite `FileProcessTensor`.
* Slight modifications to `system_dynamics.py` in order to take process
tensors with potentially infinite `max_step`.
Comment thread oqupy/gradient.py
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When running the tests, this file caused an error for test_multi_env_gradient in multi_environments_test.py at line gradient.py:399 (due to contracting non matching edges of two tensors). I think the error was already there when I picked up the code, maybe @paulreastham knows what could be the cause?

Comment thread oqupy/system_dynamics.py
+ "`{BaseProcessTensor.__name__}`.")
if pt.get_initial_tensor() is not None:
raise NotImplementedError()
warnings.warn("Initial correlated states are not yet "\
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I swapped this for a warning since it was causing problems when importing a process tensor from a FileProcessTensor, where the _initial_tensor is set to a array(NaN) instead of None. It would also be possible to keep the NotImplementedError and check for either None or array(NaN), or to swap the array(NaN) for None when reading the process tensor from the file.

Comment thread oqupy/system_dynamics.py
# except Exception as e:
# raise IndexError("Specified times are invalid or out of bound.") \
# from e
try:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed it here so that an infinite max_step isn't a problem anymore. (Also prevents creating the full np.arange since range doesn't store the actual values.). Same for the changes below.

Comment thread oqupy/tempo.py
in the underlying tensor network algorithm). - It must be small enough
such that the numerical compression (using tensor network algorithms)
does not truncate relevant correlations.
rank: int (default = np.inf)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a rank parameter for TempoParameters in order to specify a maximum SVD truncation rank in addition to epsrel. We can discuss whether we want this in the final pull request (would require slightly rewriting a few tests of input parsing because the new parameter is not added at the end). For now only the TTI-PT backend uses it but it could also be used for regular PT-TEMPO.

Comment thread oqupy/tti_tempo.py
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Rewrote this file with the style of pt_tempo.py, such that it can take a backend configuration, be interrupted at any step, and export to a FileProcessTensor.

Comment thread oqupy/process_tensor.py
"""
return None

def effective_step(self,
Copy link
Copy Markdown
Author

@emile-cochin emile-cochin Apr 17, 2026

Choose a reason for hiding this comment

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

Gives the effective index in the _mpo_tensors/_cap_tensors list for a given step (depending on the repeating_cell position and length). Coded such that it also works for finite process tensors, such that get_mpo_tensor and get_cap_tensor can be kept in the base SimpleProcessTensor class before specialization.

Comment thread oqupy/process_tensor.py
"""
return self._initial_tensor

def get_mpo_tensor(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Having one get_mpo_tensor method for both finite and infinite process tensors is practical because more compact, but there is a slight issue at the moment. The 3-legged infinite process tensor is expanded and transformed at every time step when it could be stored once and then reused. This won't pose much of an issue once we implement time evolution etc. with 3-legged PTs, but for now we can:

  • either change back the SimpleProcessTensorInfinite class back to how it was as a TTInvariantProcesstensor where this expansion/transformation was done only once and then stored,
  • leave it like this,
  • change this function to store the expanded/transformed tensors definitively in _mpo_tensors if the repeating_cell is not None (might cause issues if we want the untransformed tensors).

Comment thread oqupy/tempo.py
shape=shape,
epsrel=parameters.epsrel)
shape=shape)
# epsrel=parameters.epsrel)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Found this to be a problem in the case of TTI-PT, in case of high epsrel, the error on the eta coefficients was piling up and making the algorithm unstable. I don't really see why the SVD truncation epsrel should be the same as the integration one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants