Markov chain states

Define a class for Markov chain circuit states.

Note: While in abstract states the gates are encoded as strings, in Markov chain states the gates are labeled by integers. This different encoding allows to more quickly check whether a rule applies to the circuit state.

class vulqano.states.mcstates.ContinuousMCState(abstractstate)[source]

Class for continuous Markov chain circuit states.

Arguments

abstractstateAbstractCircuitState

AbstractCircuitState to be converted to a ContinuousMCState.

Attributes

vectornumpy.array

Array of gates applied at each time and on each qubit. The first index correspond to the time step, the other indices label the qubit in the lattice.

timesint

Circuit depth.

qubits : touple of ints dim : int

Number of dimension of the circuit state, i.e. 1 + number of dimensions of the qubits lattice. Number of qubits in each direction of the lattice.

rot_amplitudesnp array of float.

A numpy array of float with the same shape of the circuit, where at each entry a parameter is specified for the corresponding continuous gate.

check_rule(rule, position)[source]

Check if a rule can be applied to a region of the state.

Arguments

ruleContinuousMCRule

Continuous MC rule to be applied to a region of the state.

positiontuple of ints

Position in the time-qubit lattice where the rule is tested.

Returns

: (bool, bool) The first bool indicates if the rule can be applied. The second bool indicates the direction of the rule, always True for continuous rules.

to_abstract(name)[source]

Returns the circuit as an abstract circuit.

Arguments

namestr

Name of the circuit.

Returns

AbstractCircuitState

Abstract representation of the circuit.

transition(position, rule, transition_instructions)[source]

Locally transforms the circuit by replacing a subcircuit.

Arguments

positiontuple of ints

Position in the time-qubit lattice where the new subcircuit is placed.

ruleDiscereteMCRule

Transtition rule.

transition_instructions(np.array, mask)

Matrix representing the new subcircuit. Where the mask is true, the gate is not raplaced.

Returns

None.

class vulqano.states.mcstates.DiscreteMCState(abstractstate)[source]

Class for discrete Markov chain circuit states.

Arguments

abstractstateAbstractCircuitState

AbstractCircuitState to be converted to a DiscreteMCState.

Attributes

vectornumpy.array

Array of gates applied at each time and on each qubit. The first index correspond to the time step, the other indices label the qubit in the lattice.

timesint

Circuit depth.

qubitstouple of ints

Number of qubits in each direction of the lattice.

dimint

Number of dimension of the circuit state, i.e. 1 + number of dimensions of the qubits lattice.

rot_maskmask

True where the qubit is a rotation.

check_rule(rule, position)[source]

Check if a rule can be applied to a region of the state.

Arguments

ruleDiscreteMCRule

Discrete MC rule to be applied to a region of the state.

positiontuple of ints

Position in the time-qubit lattice where the rule is tested.

Returns

: (bool, bool) The first bool indicates if the rule can be applied. The second bool indicates the direction of the rule, True for state_a->state_b, and false for state_b->state_a.

to_abstract(name)[source]

Returns the circuit as an abstract circuit.

Arguments

namestr

Name of the circuit.

Returns

AbstractCircuitState

Abstract representation of the circuit.

transition(position, rule, transition_instructions)[source]

Locally transforms the circuit by replacing a subcircuit.

Arguments

positiontuple of ints

Position in the time-qubit lattice where the new subcircuit is placed.

ruleDiscereteMCRule

Transtition rule.

transition_instructions(np.array, mask)

Matrix representing the new subcircuit. Where the mask is true, the gate is not raplaced.

Returns

None.