Complex Numbers in Matrix math - Pauli Spin Matricies

I’d really love to be able to use the Pauli Spin matricies. Has anyone done something similar? How do you handle complex numbers in a matrix? Can you treat it as a template?

Hi Chris,

have a look at

in particular

TPauliMatrix : general complex 2x2 matrix, includes std ones
TPauliSpinor: general 2-spinor

Concerning your question about complex numbers in a matrix:

In ROOT the classes TMatrixD (doubles) and TMatrixF (floats) are really
just particular instantiations of the template class TMatrixT, for instance

see matrix/inc/TMatrixDfwd.h :

template class TMatrixT;
typedef TMatrixT<Double_t> TMatrixD;

You could create a complex matrix, TMatrixC, class through

typedef TMatrixT<std::complex > TMatrixC;

However, one might have to extend matrix functionalities in which
abs / norms are involved . I see that I used there TMath::Abs(…)
which is not (yet) defined for comple numbers .


I had asked this question almost 2 years ago. Is this situation the same? I have had luck using the Spinor class you pointed me too, but was curious to know if it had been incorporated into the baseline.


Hi Chris,

No , the Pauli spin matrix class is not part of the standard root tree .
I think that there would be more interest in a (more general) complex
matrix class .

It is on my to-do list but has not happened yet (You could translate
this to , I see no need (yet) for it in my research in the finance world :laughing: )


I definitely agree with your assessment that having a more general complex class would be more useful. EG: I am currently doing simulations of 2 level systems.

I would offer to help out, but I think your programming skill set is far above mine. Your work has been quite nice.