Conversation
…using both iTEBD and OQuPy
…sor in OQuPy + testing
…of time dependent Hamiltonian to iTEBD-example
… to init from get_mpo.
Modified example to use this capability.
… used with the bath_dynamics.ipynb code.
…tions of dynamics without gradients.
|
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
left a comment
There was a problem hiding this comment.
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
| return self._dt | ||
|
|
||
| @property | ||
| def max_step(self) -> Union[int, float]: |
There was a problem hiding this comment.
I am makeing a comment on the Process Tensor classes in the #155 issue thread.
…-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`.
There was a problem hiding this comment.
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?
| + "`{BaseProcessTensor.__name__}`.") | ||
| if pt.get_initial_tensor() is not None: | ||
| raise NotImplementedError() | ||
| warnings.warn("Initial correlated states are not yet "\ |
There was a problem hiding this comment.
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.
| # except Exception as e: | ||
| # raise IndexError("Specified times are invalid or out of bound.") \ | ||
| # from e | ||
| try: |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| """ | ||
| return None | ||
|
|
||
| def effective_step(self, |
There was a problem hiding this comment.
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.
| """ | ||
| return self._initial_tensor | ||
|
|
||
| def get_mpo_tensor( |
There was a problem hiding this comment.
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
SimpleProcessTensorInfiniteclass back to how it was as aTTInvariantProcesstensorwhere 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_tensorsif therepeating_cellis notNone(might cause issues if we want the untransformed tensors).
| shape=shape, | ||
| epsrel=parameters.epsrel) | ||
| shape=shape) | ||
| # epsrel=parameters.epsrel) |
There was a problem hiding this comment.
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?
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.
tox -e py36(to runpytest) the code tests.tox -e style(to runpylint) the code style tests./docs/pages/modules.rsthas been updated./docs/pages/api.rsthas been updated.