quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
356 stars 105 forks source link

`stimcirq.CXSwapGate.num_qubits()` and `stimcirq.CZSwapGate.num_qubits()` raise type error #828

Closed AlMrvn closed 2 months ago

AlMrvn commented 2 months ago

When using the stimcirq gate stimcirq.CXSwapGate and timcirq.CZSwapGate wtiuh the num_qubits method, this raise the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[18], line 1
----> 1 stimcirq.CZSwapGate.num_qubits()

File ~/.virtualenvs/pyle/lib/python3.11/site-packages/cirq/value/abc_alt.py:137, in ABCMetaImplementAnyOneOf.__new__.<locals>.wrap_scope.<locals>.impl_of_abstract(*args, **kwargs)
    136 def impl_of_abstract(*args, **kwargs):
--> 137     return impl(*args, **kwargs)

TypeError: Gate._backwards_compatibility_num_qubits() missing 1 required positional argument: 'self'

This might actually be a cirq issue?

AlMrvn commented 2 months ago

I was stupid, the gate need to be properly constructed: stimcirq.CZSwapGate()