TransWikia.com

Why is circuit inverse not working for EfficientSU2?

Quantum Computing Asked on August 2, 2021

For some reason I get the following error when attempting to find the inverse of the EfficientSU2 VQE variational form:

TypeError: ‘NoneType’ object is not reversible

My code is as follows:

var_form = EfficientSU2(6, entanglement="linear")
var_form_inv = var_form.inverse() # error thrown of this line

Is there a bug in the implementation of the inverse method? and if so how can I implement a working inverse function?

Note qiskit.__qiskit_version__:

{'qiskit-terra': '0.15.2',
 'qiskit-aer': '0.6.1',
 'qiskit-ignis': '0.4.0',
 'qiskit-ibmq-provider': '0.9.0',
 'qiskit-aqua': '0.7.5',
 'qiskit': '0.21.0'}

One Answer

EfficientSU2 is a BlueprintCircuit and does not populates its internal data field until you try to access them.

In this case, when you are calling the inverse function the data are still empty (None) and this is the error you are getting. It is probably a bug and should be fixed.

Nevertheless, as a workaround for now you can try:

var_form = EfficientSU2(6, entanglement="linear")
# build the circuit
var_form._build() 
# or just print it
print(var_form)
var_form_inv = var_form.inverse() 

Correct answer by tsgeorgios on August 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP