qutip / qutip

QuTiP: Quantum Toolbox in Python
https://qutip.org
BSD 3-Clause "New" or "Revised" License
1.64k stars 628 forks source link

Support for direct products #2384

Open pmenczel opened 3 months ago

pmenczel commented 3 months ago

Problem Description

Currently, there is no great support for working with direct product spaces in qutip. For that reason, both the HEOM solver and qutip-qoc contain code manipulating data layer matrices directly.

Most commonly, direct product spaces arise because of coupled differential equations. For example, we might have two states $|\psi\rangle$ and $|\psi'\rangle$ satisfying

$$ \partial_t \begin{pmatrix} |\psi\rangle \\ |\psi'\rangle \end{pmatrix} = -i \begin{pmatrix} H & 0 \\ H' & H \end{pmatrix} \begin{pmatrix} |\psi\rangle \\ |\psi'\rangle \end{pmatrix} $$

then the object $( |\psi\rangle, |\psi'\rangle )$ is a direct product.

Some applications:

Proposed Solution

I think that we would need the following:

Alternate Solutions

If all the involved Hilbert spaces have the same dimension, then $\mathcal H \times \cdots \times \mathcal H \simeq \mathbb C^n \otimes \mathcal H$. In other words, a "big matrix" can be obtained by tensoring a "small matrix" with another appropriate matrix, for example

$$ \begin{pmatrix} H & 0 \\ H' & H \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \otimes H + \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} \otimes H' . $$

This can be written in qutip already now, of course. However, proper support for this kind of object would be nicer. Also, it is not clear to me how one would apply this tensoring-approach, for example, to the coupled differential equations for unitary operators in goat.

Additional Context

No response

ajgpitch commented 3 months ago

Just to add that we also have operator evolution in the form

$$ \partial_t \begin{pmatrix} U \\ U' \end{pmatrix} = -i \begin{pmatrix} H & 0 \\ H' & H \end{pmatrix} \begin{pmatrix} U \\ U' \end{pmatrix}, $$

and similar with $U$ switched for a map and $H$ for some Lindblad superoperator, in goat, which seems to work fine in terms of the multiplication during the ODE update step. So, as suggested, it would seem that mainly we just want a nice, efficient method for constructing / extracting these objects.