1

I'd like to go between $n \times m$ matrices with quaternionic entries to (using, it would seem, the Pauli matrix conversion scheme) to $2 n \times 2 m$ matrices with complex entries, and vice versa. I'd appreciate some efficient coding to accomplish this pair of tasks.

Say we have an $n \times m$ matrix the $n m$ entries of which are quaternions. We want to generate a $2 n \times 2 m$ matrix through the rule

Quaternion[a_, b_, c_, d_] -> 
  (a IdentityMatrix[2] - b PauliMatrix[1] - c PauliMatrix[2] - d PauliMatrix[3])

So, it seems that we have to appropriately reshape the resultant array (using, presumably, ArrayReshape) to the desired $2 n \times 2 m$ form.

Then, what off-hand seems more challenging, we want to be able to perform the inverse operation (going from the $2 n \times 2 m$ form to the [quaternionic-entry] $n \times m$ form]). Such an inverse operation would assume that the matrix to be transformed back possesses the indicated special (Pauli matrix) structure.

As some background to this problem, what I am really interested in accomplishing is finding the appropriate way to generate random quaternionic $4 \times 4$ density matrices with respect to Hilbert-Schmidt measure. The manner of accomplishing this for random complex $4 \times 4$ density matrices and random real $4 \times 4$ density matrices is presented in

https://arxiv.org/pdf/0909.5094.pdf

(see eq. (1) and bot. p. 9 there). It seems that I may have to convert the $4 \times 4$ quaternionic-entry matrices to $8 \times 8$ form and use the developed rule for complex-entry matrices.

Some background references to the general quaternionic/Pauli matrix topic are (the amazingly detailed)

https://physics.stackexchange.com/questions/271419/why-is-there-this-relationship-between-quaternions-and-pauli-matrices

and

http://mathworld.wolfram.com/Quaternion.html

which has a very explicit (eqs. (2)-(5)) straightforward treatment pertaining to the issue raised.

As well as wikipedia,

https://en.wikipedia.org/wiki/Pauli_matrices#Quaternions

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Paul B. Slater
  • 2,335
  • 10
  • 16
  • Please post any code you have tried and point out where exactly you're having difficulties. Without that, it will be difficult to write an answer that meets your needs. – Jens Jun 21 '17 at 21:17
  • Thanks, Jens! Well, I was hoping for some code that would avoid having to go entry-by-entry, but rather work in some more "global" (presumably, more efficient) blockwise manner, possibly using the Partition (ArrayReshape?) command. Actually, I'm most interested in $4 \times 4$ and $2 \times 2$ matrices with quaternionic entries. – Paul B. Slater Jun 21 '17 at 22:55
  • I think this will suffer the fate of all-too many questions that may be interesting but don't contain enough information to attract the attention of other Mathematica users. Remember this is a Mathematica and not a physics site. The form of the end result is actually quite ambiguous, I think. – Jens Jun 22 '17 at 00:22
  • 4
    Please take your time to edit into this question an example of the 2x2 and 4x4 matrices and define what the Pauli matrix conversion scheme is. As a physicist and a user of MMA I'll be happy to learn something outside of my field and to try solving a problem with my favorite tool. Once these details are included, I'll be more than willing to vote to reopen. VTC for now. – LLlAMnYP Jun 22 '17 at 06:06
  • 1
    My guess is you need KroneckerProduct, similar to this question. But it's only a guess until the desired input and output forms are described in more detail. – Jens Jun 22 '17 at 15:44
  • Looks like for the inverse operation you could use the orthogonality relation of the Pauli matrices as in my answer here, which actually does something very similar to what you're asking, by constructing matrices in a product space and transforming them back to operator notation. – Jens Jun 22 '17 at 17:07
  • Matrix m with dimensions {4, 4, 2, 2} -> {8, 8} can be done with ArrayFlatten[m], and {8, 8} -> {4, 4, 2, 2} can be done with Partition[m, {2, 2}]. – Carl Woll Jun 22 '17 at 17:27
  • Thanks, Carl Woll. This seems very helpful. Of course, these are the appropriate/natural ways to do the conversions. What's outstanding now it seems, is to how to express the derived {4,4,2,2} form back into the {4,4} form with explicitly quaternionic entries, that is, reverse the Quaternion[a_, b_, c_, d_] -> (a IdentityMatrix[2] - b PauliMatrix[1] - c PauliMatrix[2] - d PauliMatrix[3]) operation. – Paul B. Slater Jun 22 '17 at 18:46
  • I've expanded on the physics aspects of this problem in https://physics.stackexchange.com/questions/340866/how-does-one-generate-a-random-n-times-n-density-matrix-with-quaternionic-ent – Paul B. Slater Jun 22 '17 at 20:21

1 Answers1

4

Here are some functions to convert back and forth between quaternions and Pauli matrices:

basis = {IdentityMatrix[2], -PauliMatrix[1], -PauliMatrix[2], -PauliMatrix[3]};
$ProjectionMatrices = Transpose[basis, {3,1,2}]/2;

toQuant[m_] := Quaternion @@ Simplify @ Tr[m . $ProjectionMatrices, Plus, 2]
fromQuant[Quaternion[a_, b_, c_, d_]] := {a, b, c, d} . basis

So, a function to convert a matrix of quaternions to and from a "Pauli form" could be:

toPauli[m_] := ArrayFlatten[m /. q_Quaternion :> fromQuant[q]]

fromPauli[m_] := Map[toQuant, Partition[m, {2, 2}], {-3}]

For example:

m = Apply[Quaternion,RandomInteger[10,{4,4,4}],{2}]

{{Quaternion[2, 3, 9, 4], Quaternion[1, 10, 9, 5], Quaternion[10, 0, 4, 9], Quaternion[0, 0, 8, 7]}, {Quaternion[10, 5, 6, 7], Quaternion[0, 5, 5, 8], Quaternion[8, 8, 1, 0], Quaternion[3, 3, 5, 10]}, {Quaternion[0, 7, 1, 4], Quaternion[5, 1, 3, 3], Quaternion[0, 0, 9, 8], Quaternion[4, 8, 1, 5]}, {Quaternion[6, 0, 4, 4], Quaternion[9, 7, 8, 3], Quaternion[1, 4, 6, 0], Quaternion[5, 2, 6, 10]}}

p = toPauli[m];
p //TeXForm

$\left( \begin{array}{cccccccc} -2 & -3+9 i & -4 & -10+9 i & 1 & 4 i & -7 & 8 i \\ -3-9 i & 6 & -10-9 i & 6 & -4 i & 19 & -8 i & 7 \\ 3 & -5+6 i & -8 & -5+5 i & 8 & -8+i & -7 & -3+5 i \\ -5-6 i & 17 & -5-5 i & 8 & -8-i & 8 & -3-5 i & 13 \\ -4 & -7+i & 2 & -1+3 i & -8 & 9 i & -1 & -8+i \\ -7-i & 4 & -1-3 i & 8 & -9 i & 8 & -8-i & 9 \\ 2 & 4 i & 6 & -7+8 i & 1 & -4+6 i & -5 & -2+6 i \\ -4 i & 10 & -7-8 i & 12 & -4-6 i & 1 & -2-6 i & 15 \\ \end{array} \right)$

m == fromPauli[p]

True

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
  • Looks great!--will study. – Paul B. Slater Jun 22 '17 at 21:01
  • OK!. Now, how about going from the original $n \times m$ quaternionic -entried matrix to a $4 n \times 4 m$ real-entried matrix, and possibly vice versa--see https://math.stackexchange.com/questions/2010172/represent-a-complex-valued-matrix-into-real-valued-matrix . Doing so may have some value in addressing the eigenvalue problem for quaternionic Hermitian matrices http://ac.els-cdn.com/S0377042712003822/1-s2.0-S0377042712003822-main.pdf?_tid=1479e256-584d-11e7-b566-00000aab0f02&acdnat=1498247553_c2c9350f891963559e0f89728d8fa2f6 . – Paul B. Slater Jun 23 '17 at 20:02