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

Refactor indexing #230

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

Refactor indexing #230

wants to merge 4 commits into from

Conversation

david-pl
Copy link
Member

This lays the foundation for refactoring the entire indexing implementation. The basic idea is one we already discussed in the very beginning. Essentially, we want to use the following commutation relation for indexed bosonic operators

$$ a_i a_j^\dagger = a_j^\dagger a_i + \delta_{ij} $$

Similarly, for transition operators, we have

$$ \sigma_r^{ij} \sigma_s^{k\ell} = \delta_{jk}\delta_{rs}\sigma_r^{i\ell} + (1 - \delta_{rs})\sigma_r^{ij}\sigma_s^{k\ell} $$

The problem here is the fact that the original product of transition operators on the left-hand side appears again on the right-hand side. This can potentially lead to infinite recursion. Currently, the solution to this problem is to store the fact that in the latter product $r \neq s$ on any sum expression that may occur. This has other problems, mostly the complex implementation and handling all kinds of special cases.

Instead, here I propose to implement the commutation relations using the above relations directly. To prevent infinite recursion on the transition operators, we store an additional field on indexed operators called merge_events, which is just a Vector{UUID}. Whenever two indexed transitions get rewritten according to the above, we generate a random UUID, currently using UUIDs.uuid4(), and store that on two copies of the original transition operators. Therefore, the operators behave just as they should when multiplied together with other operators, except when we find a shared UUID in the merge_events. That can only occur when a product of indexed transitions was returned from the * implementation and thus they have already been merged.
To ensure that in products involving three or more indexed transitions, we also sort by the length of the merge_events vector.

Since this needs to be a full rewrite, I'm opening this as a draft until we add back all the features. If we don't complete the rewrite within this PR, it at least serves as documentation of the fundamental concept, which seems to work.

Feature list:

  • Basic indexed operators and commutation relations
  • Summation
  • Conversion to MTK and numeric solution
  • Scaling (replacing sums by appropriate factors)
  • Correlation functions and spectra together with indexing
  • Measurement back action with indexing

FYI, @ChristophHotter and @j-moser

@david-pl david-pl changed the title Start refactoring indexing; basics seem to work Refactor indexing Dec 17, 2024
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.

1 participant