Context:
In lab_dev, doing Vacuum(modes=[0]).to_fock_component() returns an object of type CircuitComponent. We want an object of type Ket instead.
Description of the Change:
The from_attributes method is modified so that if needed, it scans through the MRO of the class of the given object, and it returns a Ket, DM, Unitary, or Channel if possible, a CircuitComponent otherwise.
For performance reasons, this function does not validate the inputs and must therefore be used with care. To avoid bugs on the user's side, it is turned into a private method.
Context: In
lab_dev
, doingVacuum(modes=[0]).to_fock_component()
returns an object of typeCircuitComponent
. We want an object of typeKet
instead.Description of the Change: The
from_attributes
method is modified so that if needed, it scans through the MRO of the class of the given object, and it returns aKet
,DM
,Unitary
, orChannel
if possible, aCircuitComponent
otherwise.For performance reasons, this function does not validate the inputs and must therefore be used with care. To avoid bugs on the user's side, it is turned into a private method.