qiskit-aer icon indicating copy to clipboard operation
qiskit-aer copied to clipboard

Decompose PauliLindbladError into subsystem errors before attempting to simulate

Open aeddins-ibm opened this issue 11 months ago • 0 comments

What is the expected behavior?

PauliLindbladError was created to facilitate doing many-qubit simulations with Sparse Pauli-Lindblad noise.

However, attempting to simulate a circuit with a many-qubit PauliLindbladError fatally crashes (in my notebook, it crashes the kernel). This should not occur if the PauliLindbladError is truly sparse in the relevant sense, i.e. each error term involves only a few qubits. In this example, the error is really only a 1-qubit error, with identities on all other qubits, but it still crashes:

from qiskit_aer import AerSimulator
from qiskit_aer.noise import PauliLindbladError
from qiskit import QuantumCircuit

num_qubits = 12
qc = QuantumCircuit(num_qubits)
qc.append(PauliLindbladError([('I'*(num_qubits-1))+'X'],[0.001]),range(num_qubits))

backend = AerSimulator()
job = backend.run(qc)

Presumably this crash is related to attempting to construct the twelve-qubit error channel as a very large matrix. It would be convenient if Aer could try to avoid this by first decomposing the PauliLindbladChannel into subsystem errors, which should, in many cases, break up the many-qubit channel into an equivalent set of few-qubit channels, which can then be included in the simulation as usual:

ple = PauliLindbladError([('I'*(num_qubits-1))+'X',
                          'I'*(num_qubits-2)+'XX',
                          'I'*(num_qubits-4)+'IXXI'],
                          [0.001,0.002,0.003])
ple.subsystem_errors()

The output contains smaller channels that can be substituted into the circuit in place of the original PauliLindbladError, and then simulated without memory issues:

[(PauliLindbladError(['IX', 'XX'], [0.001, 0.002]),
  (np.int64(0), np.int64(1))),
 (PauliLindbladError(['XX'], [0.003]), (np.int64(1), np.int64(2)))]

aeddins-ibm avatar Nov 22 '24 06:11 aeddins-ibm