quri_parts.circuit.parameter_mapping module#
- ParameterValueAssignment#
- ParameterValueAssignment represents a - Mappingwhich assigns concrete values to a set of parameters.
- Mapper#
- Mapper represents a function that maps a set of parameter values (input) to another set of parameter values (output). - alias of - Callable[[- Mapping[- Parameter,- float]],- Mapping[- Parameter,- float]]
- SeqMapper#
- SeqMapper represents a function that maps a sequence of parameter values (input) to another sequence of parameter values (output). - alias of - Callable[[- Sequence[- float]],- Sequence[- float]]
- class ParameterMapping(*args, **kwargs)#
- Bases: - Protocol- ParameterMapping represents a mapping of a set of parameters to another set of parameters. - It can be considered as a function mapping \(m\) input parameters to \(n\) output parameters: \[(\theta^\text{(out)}_0, \ldots, \theta^\text{(out)}_{n-1}) = f(\theta^\text{(in)}_0, \ldots, \theta^\text{(in)}_{m-1})\]- abstract property mapper: circuit.parameter_mapping.Mapper#
- Returns a function that maps an input - ParameterValueAssignmentto an output- ParameterValueAssignment(i.e. \(f\)).- It is expected that the function captures the state of - ParameterMappingat the time that this property is accessed and does not reflect subsequent changes in the state of the- ParameterMappinginstance.
 - abstract property seq_mapper: circuit.parameter_mapping.SeqMapper#
- Returns a function that maps a sequence of input parameter values to a sequence of output parameter values (i.e. \(f\)). - It is expected that the function captures the state of - ParameterMappingat the time that this property is accessed and does not reflect subsequent changes in the state of the- ParameterMappinginstance.
 - get_derivatives()#
- Returns a sequence of - ParameterMappings of derivatives of the original- ParameterMappingwith respect to each input parameter.- The returned sequence corresponds to \[\left( \frac{\partial f}{\partial \theta^\text{(in)}_0}, \ldots, \frac{\partial f}{\partial \theta^\text{(in)}_{m-1}} \right),\]- where \(f\) is defined as described in - ParameterMappingdocstring.- Return type:
- Sequence[ParameterMapping] 
 
 
- class ParameterMappingBase#
- Bases: - ABC- An abstract class used as a base for implementing - ParameterMapping.- Currently this class only has a general implementation of - seq_mapper()method.- abstract property mapper: circuit.parameter_mapping.Mapper#
 - abstract property is_trivial_mapping: bool#
- Returns if the mapping is trivial one-to-one mapping (Identity function). 
 - property seq_mapper: circuit.parameter_mapping.SeqMapper#
 
- LinearParameterFunction#
- A type representing a linear (affine) function of parameters. It is an alias for mapping from - Parameterto float coefficients. A constant term can be represented as a coefficient for- CONST.
- ParameterOrLinearFunction#
- A union type of - Parameterand- LinearParameterFunction.
- class LinearParameterMapping(in_params=(), out_params=(), mapping={})#
- Bases: - ParameterMappingBase- A - ParameterMappingrepresenting a linear (affine) transformation of parameters.- The mapping is represented as a - Mappingfrom- Parameters to- ParameterOrLinearFunctions. For example, if the mapping is defined as:\[\begin{split}\begin{align} \theta^\text{(out)}_0 &= 0.1\theta^\text{(in)}_1 + 0.2, \\ \theta^\text{(out)}_1 &= 0.3\theta^\text{(in)}_0 + 0.4\theta^\text{(in)}_1, \end{align}\end{split}\]- the - mappingargument should be as the following:- { out_param_0: { in_param_1: 0.1, CONST: 0.2 }, out_param_1: { in_param_0: 0.3, in_param_1: 0.4 }, } - where - in_param_0(1)and- out_param_0(1)are input and output- Parameterinstances respectively.- Parameters:
 - with_data_updated(*, in_params_addition=(), out_params_addition=(), mapping_update={})#
- Parameters:
- Return type:
 
 - property mapper: circuit.parameter_mapping.Mapper#
 - property is_trivial_mapping: bool#
- Returns if the mapping is trivial one-to-one mapping (Identity function). 
 - get_derivatives()#
- Returns a sequence of - LinearParameterMappings of derivatives of the original- LinearParameterMappingwith respect to each input parameter.- Since the original mapping is linear, the returned mappings only contains constant terms. For example, for the linear mapping defined in the docstring of - LinearParameterMapping, the returned derivatives are as follows:\[\begin{split}\begin{align} \frac{\partial f}{\partial \theta^\text{(in)}_0} &= (0, 0.3)\\ \frac{\partial f}{\partial \theta^\text{(in)}_1} &= (0.1, 0.4) \end{align}\end{split}\]- Return type:
- Sequence[LinearParameterMapping] 
 
 - combine(other)#
- Parameters:
- other (LinearParameterMapping) – 
- Return type: