Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding extra fitting methods for quantum environments #2594

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

gsuarezr
Copy link
Contributor

@gsuarezr gsuarezr commented Jan 7, 2025

Description
This PR aims to add other methods used to generate decaying exponential decompositions of environments. The methods added in this PR have been applied to fermionic environments in the literature, while the current draft PR only implements these methods for bosonic environments, hopefully they can be used in fermionic environments soon. The key issue there is how to create the interface for the creation of arbitrary fermionic environments.

The methods this PR aims to add are :

  • AAA
  • Prony
  • Matrix Pencil
  • Esprit
  • Espira
  • AAA with balanced truncation

Checklist

  • Refactor fitting methods
  • Consult whether to use custom AAA for now or use the scipy implementation and require the version of scipy that supports it (AAA was made available recently in scipy 1.15)
  • Add unit tests for fitting methods
  • Include the changelog

Related issues or PRs
#2580

@@ -767,6 +768,133 @@ def approx_by_sd_fit(
ckAR, vkAR, ckAI, vkAI, combine=combine, T=self.T, tag=tag)
return approx_env, fit_info

def approx_by_aaa(
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we might have an every growing number of such methods so perhaps we should have one method named approximate that accepts a method name and dispatches the rest of the arguments to the implementing functions. For example, in a simple implementation .approximate("aaa", ...) might end up calling _approx_by_aaa(...).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Simon,

I wasn´t expecting any comment so soon, thanks a lot!

Indeed, there seems to be a growing number of methods appearing in the literature. I added the ones in this review article (sorry to attach a paper behind a paywall sadly no arxiv 😢 ). If @pmenczel agrees then I think that's probably the best solution, I guess the main issue would be that some methods don´t take in the same parameters so it might be confusing for a user but I think that's fine 😄

To be honest for my purposes only Prony and AAA are of importance, but since the other ones are similar I included them as well, but not 100% sure all should be included in the end.

Copy link
Member

Choose a reason for hiding this comment

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

In principle I would like an implementation like .approximate("aaa", ...). That is actually how I implemented it at first. However, I found it very annoying to use since all the methods require different parameters, and the IDE then didn't show a tooltip listing the required parameters. That is why I went with having different functions.

Perhaps that could be fixed using @overload, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I played around with overload in the last week, and I could get the hinting working for simple cases, but when doing it similarly in the code we already have for some reason it no longer works, at least not in vscode, I'm still looking into it though!
Sorry for not replying before 😢

@coveralls
Copy link

coveralls commented Jan 7, 2025

Coverage Status

coverage: 87.752%. first build
when pulling 8966d53 on gsuarezr:bath_pr_refactor2
into 56b81d6 on qutip:master.

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.

4 participants