Introduce SuperOperatorMatrixForm and add matrix_form argument#707
Open
albertomercurio wants to merge 11 commits into
Open
Introduce SuperOperatorMatrixForm and add matrix_form argument#707albertomercurio wants to merge 11 commits into
SuperOperatorMatrixForm and add matrix_form argument#707albertomercurio wants to merge 11 commits into
Conversation
…ll superoperators functions
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
TendonFFF
reviewed
May 6, 2026
| function LinearAlgebra.mul!(v::AbstractMatrix, op::SprePostSuperOperator, u::AbstractMatrix, α::Number, β::Number) | ||
| iscached(op) || throw(ArgumentError("The cache for the SprePostSuperOperator must be initialized before multiplication. Use `cache_operator` to initialize the cache.")) | ||
| mul!(op.cache, op.L, u) # cache = L * u | ||
| mul!(v, op.cache, op.R, α, β) # v = α * (L * u * R) + β * v |
Collaborator
There was a problem hiding this comment.
this is potentially dense * sparse, and hurt performance greatly
Member
Author
There was a problem hiding this comment.
Don't we have already have efficient methods for dense * sparse multiplication?
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.
Checklist
Thank you for contributing to
QuantumToolbox.jl! Please make sure you have finished the following tasks before opening the PR.make test.juliaformatted by running:make format.docs/folder) related to code changes were updated and able to build locally by running:make docs.CHANGELOG.mdshould be updated (regarding to the code changes) and built by running:make changelog.Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.
Description
This package currently supports the superoperator representation in the framework of vectorized density matrix. By doing so, every superoperator is represented as a matrix. However, this can be suboptimal in several cases, especially when the system size increases.
Thus, I implemented here the support for the matrix form representation. In this framework, the density matrix remains a matrix (
Operator()). The right and left-right action is obtained through the use of SciMLOperators.jl.The user just needs to set
matrix_form = Val(true)in order to use this framework. For examplemesolve(H, psi0, tlist, c_ops; matrix_form = Val(true))liouvillian(H, c_ops; matrix_form = Val(true))liouvillian_dressed_nonsecular(H, fields, T_list; matrix_form = Val(true))There is currently this PR (SciML/SciMLOperators.jl#370) in SciMLOperators.jl that improves the cache efficiency for such cases, reducing even more the memory usage. This PR cannot be merged before that PR.
Transverse Field Ising Model Benchmarks
I benchmark now both the memory and the computational efficiency of
mesolve. The benchmarks are performed on the GPU NVIDIA 4090.Liouvillian Dressed Nonsecular Benchmarks
I then test the
liouvillian_dressed_nonsecular, which is known to be poorly sparse.CPU case
GPU
Related Issues
This PR fixes #617