Generic interferometer missing in perceval

I am trying to use the circuit “Generic Interferometer”, described here Circuits — perceval 0.10.2 documentation and used here The shortest path problem using QUBO — perceval 0.10.2 documentation
I installed the latest version of perceval and I can’t find it. Does the implementation way changed ? Is it still possible to make Generic Interferometers, or do I have to build the circuit with my bare hands ?
Thank you in advance


The Generic Interferometer is still available in Perceval 0.10. You can access it from the former syntax (even though it’s been deprecated, it still works), in the Circuit class, or from the new GenericInterferometer class.

Here’s an example script that works well with Perceval 0.10.2:

import perceval as pcvl
from perceval.components import Circuit, GenericInterferometer, catalog
from perceval.utils import InterferometerShape

# Former syntax - deprecated but still working
gi1 = Circuit.generic_interferometer(4, catalog["mzi phase first"].generate, shape="triangle")

# New syntax
gi2 = GenericInterferometer(4, catalog["mzi phase first"].generate, shape=InterferometerShape.TRIANGLE)


It shows the drawing of both interferometers (which are the same) and displays the following warning message in the console:

DeprecationWarning: Call to deprecated function (or staticmethod) generic_interferometer. (Construct a GenericInterferometer object instead) – Deprecated since version 0.10.0.
gi1 = Circuit.generic_interferometer(4, catalog[“mzi phase first”].generate, shape=“triangle”)

If this code doesn’t work on your environment, please check your Perceval version.

  • pip freeze | grep perceval-quandela in a unix terminal
  • print(pcvl.__version__) from inside a Python script

Don’t hesitate to let me know if I can help.

Best wishes,

Thank you very much !