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

Create a A @ B.dag() operation #2610

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Ericgig
Copy link
Member

@Ericgig Ericgig commented Jan 15, 2025

Description
Create function to compute A @ B.dag() in one operation.
This will help with super operators not using super representation.

For example kraus operators: A @ rho @ A.dag().

For CSR operators, CSR @ Dense is fast, but Dense @ CSR is slow. (We have to convert one of the matrices.)

However Dense @ CSR.dag == ( CSR.conj @ Dense.T ).T. Transposing dense array is free since we support both c and fortran ordered matrices, so we can do that operation almost as fast as the usual CSR @ Dense operation.

For Dense @ Dense operation, lapack matmul function support A @ B.dag. So the new operation allows to do the matmul without creating the temporary dag matrix.

@Ericgig Ericgig changed the title Create a A @ B.dag() operation Create a A @ B.dag() operation Jan 15, 2025
@coveralls
Copy link

Coverage Status

coverage: 87.715% (-0.007%) from 87.722%
when pulling bf450e2 on Ericgig:feature.matmul_dag
into 1fc49b2 on qutip:master.

@pmenczel
Copy link
Member

Brief question for my own understanding. Will this new function somehow automatically be called when I write A @ B.dag()? Or would I have to write something like qutip.core.data.matmul.matmul_dag(A.data, B.data)?

@Ericgig
Copy link
Member Author

Ericgig commented Jan 23, 2025

With this PR, it will need to be used manually.
It will be useful for some specific physic based integrator method.
We also played with a split pre-post QobjEvo for dense representation. I would like to make this official with a KrausMap class.
(I made a draft in my fork: Ericgig#14)

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.

3 participants