brownadder / magpy

Magnus based time-integration for spins and qubits under a magnetic field
MIT License
1 stars 2 forks source link

Sigma class multiplication #25

Closed dannygoodacre closed 4 months ago

dannygoodacre commented 1 year ago

Expected Behaviour

Composition when spins are in disjoint sites:

Sigma(x = 3) * Sigma(z = 2) == Sigma(x = 3,  z = 2)
Sigma(x = 3) * Sigma(x = 5) == Sigma(x = {3,5})

Composition when spins are in the same sites:

Sigma(x = 1) * Sigma(y = 1) == Sigma(z = 1, scale = 1j)
Sigma(y = 1) * Sigma(x = 1) == Sigma(z = 1, scale = -1j)

These statements should be interchangeable with Sigma.X, Sigma.Y, Sigma.Z:

Sigma.X(3,5) * Sigma(y = 3) == Sigma(z = 3, x = 5, scale = 1j)

Multiplying by scalar:

0 * Sigma(x = 1, y = 2, scale = 4) == Sigma(scale = 0)
3 * Sigma(x = 1) == Sigma(x = 1, scale = 3)

Multiplying by identity:

I = Sigma()
I * Sigma.Z(1,2) == Sigma(z = {1,2})

The Mathematics Behind It

For $\alpha,\beta,\gamma\in\{1,2,3\},$

\sigma_\alpha\sigma_\beta = \delta_{\alpha\beta}\text{I} + i\epsilon_{\alpha\beta\gamma}\sigma_\gamma,

meaning we can write

\sigma_\alpha\sigma_\beta = \kappa\phi,

where

(\kappa,\phi) = \begin{cases}
    (1,\,\text{I}), & \text{if}\;\alpha = \beta.\\
    (i\epsilon_{\alpha\beta\gamma},\,\sigma_\gamma), & \text{otherwise.}
\end{cases}

Now let $\alpha_0,\beta_0\in\mathbb{C}$, $\alpha_1,\ldots,\alpha_n,\beta_1,\ldots,\beta_n\in{0,1,2,3}$, and

A = \alpha_0\bigotimes_{t=1}^n\sigma_{\alpha_t},\;\;\;\;
B = \beta_0\bigotimes_{t=1}^n\sigma_{\beta_t}.

Then, using the above and the mixed-product property of the Kronecker product,

$$ AB = \alpha_0\beta0\prod{t=1}^n\kappat\bigotimes{t=1}^n\phi_t. $$

The idea here is that, given two Sigma instances, we can work element-wise through their dictionaries to calculate the dictionary and scalar term of their product.

This also means that for any product of Sigma instances we get a dictionary representation which has only one Pauli matrix (or Identity) at each site.