I call this the "Paulinomial decomposition" as you are writing the matrix $H$ as a polynomial of Pauli matrices:

$H=a_{XX}X_1X_2 + a_{XY}X_1Y_2 +a_{XZ}X_1Z_2 + a_{XI}X_1 + a_{YY}Y_1Y_2 + \cdots $ (for the 2-qubit case).

To get the coefficients, you can use this formula:

$a_{ij}=\frac{1}{4}\textrm{tr}\left((\sigma_i\otimes \sigma_{j})H\right)$

For example, here is a 2-qubit gate (the square root of the SWAP gate) written as a polynomial of Pauli matrices:

You can even do this for a $2^n \times 2^n$ Hamiltonian, for example an 8x8 Hamiltonian can be done like this:

$a_{ijk}=\frac{1}{8}\textrm{tr}((\sigma_i\otimes \sigma_{j}\otimes \sigma_{k}))H)$

I have a code that can also do it for arbitrary matrices (not only $2^n \times 2^n$, but I haven't touched it for 2 years and might need to test it again). If it would be helpful, I can try to dig it up and polish it for you to use.

Hi and welcome to Quantum computing SE. There is probably missing figure or equation because there is written

What I have tried so far is this:but then there is nothing. – Martin Vesely – 2020-05-07T21:57:30.7833Please clarify what exactly you are asking for. Right now,

`H = qutip.sigmax()`

seems like it would be a possible answer to your question: it's an Hermitian matrix decomposed into a linear combination of Pauli matrices, written in python. I'm guessing you are asking for something more specific? – glS – 2020-05-08T12:30:22.457The user accepted my answer. What they want is clear. Please re-open or choose a close reason different from "needs details for clarity". – user1271772 – 2021-02-27T21:23:09.510