There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The QuantumCircuit.squ
method takes a unitary 2x2 matrix $U$ and a qubit and computes the decomposition
$$
U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma)
$$
This is a common decomposition, you can find a proof here https://arxiv.org/pdf/quant-ph/9503016.pdf in Lemma 4.1.
Here's how to do it in Qiskit:
import numpy as np
from scipy.linalg import expm
from qiskit import QuantumCircuit, QuantumRegister
# define your matrix
A = np.array([[1.5, 0.5],
[0.5, 1.5]])
t = np.pi / 2
# expm is a matrix exponential
U = expm(1j * t * A)
# create a 1 qubit circuit
q = QuantumRegister(1, name='q')
circuit = QuantumCircuit(q)
# apply a single-qubit unitary gate, this will do the decomposition
circuit.squ(U, q[0])
# print the circuit components
print(circuit.decompose().decompose().draw())
This will print
┌──────────┐┌───────────┐┌───────────┐
q_0: |0>┤ Rz(pi/2) ├┤ Ry(-pi/2) ├┤ Rz(-pi/2) ├
└──────────┘└───────────┘└───────────┘
So your decomposition would be
$$
e^{iAt} = R_Z\left(\frac{\pi}{2}\right) R_Y\left(-\frac{\pi}{2}\right) R_Z\left(\frac{-\pi}{2}\right)
$$
with
$$
R_Y(\theta) = \begin{pmatrix}
\cos(\theta / 2) & -\sin(\theta / 2) \\
\sin(\theta / 2) & \cos(\theta / 2)
\end{pmatrix}
$$
and
$$
R_Z(\lambda) = \begin{pmatrix}
1 & 0 \\
0 & e^{i\lambda}
\end{pmatrix}
$$
You can also drop the last RZ
gate if you don't care about the global phase. That's also supported in Qiskit using the up_to_diagonal
argument:
# apply a single-qubit unitary gate, this will do the decomposition
circuit.squ(U, q[0], up_to_diagonal=True)
# print the circuit components
print(circuit.decompose().decompose().draw())
which produces
┌──────────┐┌───────────┐
q_0: |0>┤ Rz(pi/2) ├┤ Ry(-pi/2) ├
└──────────┘└───────────┘
Here's the implementation in Qiskit: https://qiskit.org/documentation/_modules/qiskit/extensions/quantum_initializer/squ.html.