QuantumCircuit .clear()
and .copy_empty_like()
functionality
#8132
Labels
type: feature request
New feature or request
.clear()
and .copy_empty_like()
functionality
#8132
What should we add?
Sometimes it can be useful to erase all instructions in a QuantumCircuit. This request is for:
.clear()
.We not only need to clear all data, but (at least) also update the parameter table:
.copy_empty_like()
.This functionality is already implemented for DAGCircuit, and should retain all relevant circuit properties other than the instructions and associated parameters (e.g. registers, bits, name, metadata). Notice that
quantum_circuit.copy().clear()
would give the desired outcome, however.copy()
performs a deepcopy of the circuit, which we would then erase almost completely when deleting the instructions, so this method should provide a more efficient way to do this.TODO:
.clear()
.copy_empty_like()
The text was updated successfully, but these errors were encountered: