MAINT: LindbladCoefficientBlock blocktype branching#701
Open
rileyjmurray wants to merge 29 commits intodevelopfrom
Open
MAINT: LindbladCoefficientBlock blocktype branching#701rileyjmurray wants to merge 29 commits intodevelopfrom
rileyjmurray wants to merge 29 commits intodevelopfrom
Conversation
…indblad_term_objects
…ck.reate_lindblad_term_superoperators
…ary_errorgen_indices
…_deriv_wrt_params; apply input checking in caller function LindbladErrorgen.deriv_wrt_params.
…_hessian_wrt_params
…Code refactoring tool
nkoskelo
reviewed
Feb 2, 2026
| mx.sort_indices() | ||
| else: | ||
| # superops = _np.einsum("ik,akl,lj->aij", leftTrans, superops, rightTrans) | ||
| superops = _np.transpose(_np.tensordot( |
Contributor
There was a problem hiding this comment.
Are we sure that this ordering is always going to be the best ordering performance wise?
Contributor
Author
There was a problem hiding this comment.
Not at all! But the point of this PR is to be minimally-invasive. In an ideal world we'd formally certify that the current refactor does not affect input-output behavior of the existing functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR has major changes to LindbladCoefficientBlock. I've taken care to produce code that is equivalent to the old code from an input-output perspective.
After this PR we'll be well-positioned to make a base class for LindbladCoefficientBlock (or just make LindbladCoefficientBlock a base class) from which new classes can inherit. I want to do this because I have an idea for a sparse Cholesky approach to reduced-order CPTP models.
The diff for this PR is kind of awful. Honestly, it's a little hopeless to track what happened. My ask is that we merge anyway once all tests pass. The approach I took to the refactor was to go function by function, preserving as much of the original implementation as possible. My first pass used an LLM for applying the refactoring pattern below. Once some tests failed after this, I did another pass that manually copy-pasted relevant codeblocks from the old
perform_operationfunctions into the new_perform_operation_<blocktype>helper functions.general approach
I took functions like
and refactored them to