qiskit
qiskit copied to clipboard
ZZFeatureMap does not accept layer lists for entanglement kwarg
Environment
- Qiskit version: 1.0.2
- Python version:
- Operating system:
What is happening?
N = 3
layer1 = [(0,1)]
layer2 = [(1,2)]
qc = ZZFeatureMap(N, reps=1, entanglement=[layer1, layer2])
qc.draw()
CircuitError: 'Number of items in qubits parameter (2) does not match number of qubits in the circuit (1).'
How can we reproduce the issue?
run above
What should happen?
It should work like TwoLocal does.
Any suggestions?
No response
Hi @nonhermitian ,
I have been looking into this issue and I think I have a fix for this. Because ZZFeatureMap is a child class of PauliFeatureMap I have added a method get_entangler_map() which overrides the method from NLocal (parent class of PauliFeatureMap) for when an entaglement is manually specified. But if the entaglement is not a List[List(int)] the original get_entangler_map() method from NLocal will be used. Will you be able to look at what I have done and give me some feedback?
Sorry, I started working on this issue even though it is not assigned to me.
Thanks