Non-unitary Components
Supported non-unitary components
Name |
Class Name |
|
|
---|---|---|---|
|
![]() |
![]() |
|
|
![]() |
![]() |
Time Delay
- class perceval.components.non_unitary_components.TD(dt)
Time Delay is a special component corresponding to a roll of optical fiber making as an effect to delay a photon.
Parameter of the Time Delay is the number of period the delay should be. For instance
TD(2)
will create a delay on the mode corresponding to two periods. A time delay is not expressed as a unitary matrix and can only be used in processors.- Parameters:
dt (int | Parameter) – Number of periods
- assign(assign=None)
Assign values to parameters referenced in assign
- Parameters:
assign (dict[str, float | int]) – A dictionary mapping parameter_name -> value. Set the value to the parameter whose name is parameter_name for each key of the dictionary.
- Raises:
KeyError – If parameter_name is not an existing variable parameter name of the circuit.
- property defined: bool
check if all parameters of the circuit are fully defined
- get_parameters(all_params=False, expressions=False)
Return the parameters of the component
- Parameters:
all_params (
bool
) – if False, only returns the variable parametersexpressions – if True, returns Expressions and parameters embedded in circuit components. If False, returns the raw parameters that make up the expressions only. Default False.
- Return type:
list
[Parameter
]- Returns:
the list of parameters
- property name: str
Returns component name
- param(param_name)
Extract a Parameter object from its name :type param_name:
str
:param param_name: The name of the parameter :rtype:Parameter
:return: A Parameter object
- property params: Iterable[str]
- Returns:
a list of all variable parameter names in the component
- property vars: dict[str, perceval.utils.parameter.Parameter]
- Returns:
A dictionary mapping parameter names to parameters for all variable parameters of the circuit
Loss Channel
- class perceval.components.non_unitary_components.LC(loss)
Loss channels are non-unitary components applying a fixed loss on a given mode. A loss channel is equivalent to a beam splitter with a reflectivity equal to the loss, being connected to a virtual mode containing lost photons. A loss channel is not expressed as a unitary matrix and can only be used in processors.
- Parameters:
loss (float | Parameter) – Loss rate expressed as a floating point number between 0 and 1.
- apply(r, sv)
Applies a channel loss to r-th mode on an input StateVector sv Channel loss is treated as a beam splitter with a reflectivity equal to the loss. This beam splitter being connected to a “virtual” mode containing lost photons
The output state vector contains BasicStates which are 1 mode bigger than the ones in input: (input modes count + the virtual mode)
Warning: this method loses annotations! However, it is not currently used in LC simulation (see: LossSimulator)
- assign(assign=None)
Assign values to parameters referenced in assign
- Parameters:
assign (dict[str, float | int]) – A dictionary mapping parameter_name -> value. Set the value to the parameter whose name is parameter_name for each key of the dictionary.
- Raises:
KeyError – If parameter_name is not an existing variable parameter name of the circuit.
- property defined: bool
check if all parameters of the circuit are fully defined
- get_parameters(all_params=False, expressions=False)
Return the parameters of the component
- Parameters:
all_params (
bool
) – if False, only returns the variable parametersexpressions – if True, returns Expressions and parameters embedded in circuit components. If False, returns the raw parameters that make up the expressions only. Default False.
- Return type:
list
[Parameter
]- Returns:
the list of parameters
- property name: str
Returns component name
- param(param_name)
Extract a Parameter object from its name :type param_name:
str
:param param_name: The name of the parameter :rtype:Parameter
:return: A Parameter object
- property params: Iterable[str]
- Returns:
a list of all variable parameter names in the component
- property vars: dict[str, perceval.utils.parameter.Parameter]
- Returns:
A dictionary mapping parameter names to parameters for all variable parameters of the circuit