Rules
Contains all the classes and function needed to describe and implement transition rules that replace equivalent sub-circuits in a circuit state.
- class vulqano.rules.ContinuousTransformationRule(state_a, state_b, class_index, amplitudes_condition, rot_transformation_func, test_rot_amplitudes, verify=False)[source]
Abstract continuous transformation rules linking equivalent subcircuits.
Arguments
- state_anp.array of strings
Array representing the first subcircuit gates.
- state_bnp.array of strings
Array representing the second subcircuit gates.
- class_indexint
Rules are grouped in classes, class_index labels the class of the rule.
- amplitudes_conditionnp_array -> bool
True if the rule can be applied.
- rot_transformation_funcnp_array -> np.array
A function for transforming rotation amplitudes.
- test_rot_amplitudesnp.array
test_rot_amplitudes is a numpy np.array of parameters used to completely specify an input circuit to test the validity of the rule.
- verifybool
If true, the rule is checked. Default is False.
Attributes
- state_anp.array of strings
Array representing the first subcircuit.
- state_bnp.array of strings
Array representing the second subcircuit.
- shapetuple of ints
Shape of the subcircuits involved in the rule
- any_masknumpy mask
True in correspondence of “any” gates.
- amplitudes_conditionnp_array -> bool
True if the rule can be applied.
- rot_transformation_funcnp_array -> np.array
A function for transforming rotation amplitudes.
- test_rot_amplitudesnp.array
np.array of parameters used to completely specify an input circuit to test the validity of the rule.
- class_indexint
Rules are grouped in classes, class_index labels the class of the rule.
- counters(int, int)
The first int keeps track of how many times the rule has been applied by replacing a subcircuit state_a with a subcircuit state_b. The second int is zero for continuous rules.
- involved_gatesset of strings
Gates involved in the rule.
- class vulqano.rules.DiscreteTransformationRule(state_a, state_b, class_index, verify=False)[source]
Abstract discrete transformation rules linking equivalent subcircuits.
Arguments
- state_anp.array of strings
Array representing the first subcircuit.
- state_bnp.array of strings
Array representing the second subcircuit.
- class_indexint
Rules are grouped in classes, class_index labels the class of the rule.
- verifybool
If true, the rule is checked.
Attributes
- state_anp.array of strings
Array representing the first subcircuit.
- state_bnp.array of strings
Array representing the second subcircuit.
- shapetuple of ints
Shape of the subcircuits involved in the rule
- masks(numpy mask,numpy mask)
The first mask is true in correspondence of “any” gates. The second mask is true in correspondence of “any_rot” gates.
- class_indexint
Rules are grouped in classes, class_index labels the class of the rule.
- counters(int, int)
The first int keeps track of how many times the rule has been applied by replacing a subcircuit state_a with a subcircuit state_b. The second int keeps track of how many times the rule has been applied by replacing a subcircuit state_b with a subcircuit state_a.
- involved_gatesset of strings
Gates involved in the rule.
- vulqano.rules.generate_continuous_abstract_rules(gates, dim, rules_classes='all', verify=False, generators='std')[source]
Returns a list of continuous transformation rules.
Arguments
- gatesset
The set of gates involved in the transformation rules.
- dimint
Number of dimensions of the qubits lattice.
- rules_classesstr or list of ints, optional
A list of the ints identifying the rule classes that we want to generate. Default is “all” and generates all the rule classes.
- verifybool, optional
If true, each rule is tested. Default is False.
- generators“std” or list of generators, optional
The list of generators producing the rules to be used. Default is “std”, in this case a standard list of rules is used.
Returns
- ruleslist of DiscreteTransformationRule(s)
The generated list of transition rules.
- vulqano.rules.generate_continuous_mcrules(gates, dim, rules_classes='all', generators='std')[source]
Yields continuous Markov chain rules.
Arguments
- gatesset
The set of gates involved in the transformation rules.
- dimint
Number of dimensions of the qubits lattice.
- rules_classes“all” or list of ints, optional
A list of the ints identifying the rule classes that we want to generate. Default is “all” and generates all the rule classes.
- generators“std” or list of generators, optional
The list of generators producing the rules to be used. Default is “std”, in this case a standard list of rules is used.
- vulqano.rules.generate_discrete_abstract_rules(gates, dim, rules_classes='all', verify=False, generators='std')[source]
Returns a list of discrete transformation rules.
Arguments
- gatesset
The set of gates involved in the transformation rules.
- dimint
Number of dimensions of the qubits lattice.
- rules_classesstr or list of ints, optional
A list of the ints identifying the rule classes that we want to generate. Default is “all” and generates all the rule classes.
- verifybool, optional
If true, each rule is tested. Default is False.
- generators“std” or list of generators, optional
The list of generators producing the rules to be used. Default is “std”, in this case a standard list of rules is used.
Returns
- ruleslist of DiscreteTransformationRule(s)
The generated list of transition rules.
- vulqano.rules.generate_discrete_mcrules(gates, dim, rules_classes='all', generators='std')[source]
Yields discrete Markov chain rules.
Arguments
- gatesset
The set of gates involved in the transformation rules.
- dimint
Number of dimensions of the qubits lattice.
- rules_classes“all” or list of ints, optional
A list of the ints identifying the rule classes that we want to generate. Default is “all” and generates all the rule classes.
- generators“std” or list of generators, optional
The list of generators producing the rules to be used. Default is “std”, in this case a standard list of rules is used.