Ansatz Library

For convenience a library of state preparations, unitaries, and circuit-based noise model are provided.

State Preparations

qnetvo.bell_state_copies(settings, wires)[source]

Initializes \(n\) Bell states on \(2n\) wires. The first \(n\) wires represent Alice’s half of the entangled state while Bob’s half consists of the remaining \(n\) wires. Entanglement is shared between Alice and Bob, however, the independent Bell states are not initially entangled with each other.

Parameters:
  • settings (list[empty]) – A placeholder parameter that is not used.

  • wires (qml.Wires) – The wires on which the bell states are prepared.

qnetvo.ghz_state(settings, wires)[source]

Initializes a GHZ state on the provided wires.

Parameters:
  • settings (list[empty]) – A placeholder parameter that is not used.

  • wires (qml.Wires) – The wires on which the GHZ state is prepared.

qnetvo.max_entangled_state(settings, wires)[source]

Ansatz function for maximally entangled two-qubit state preparation.

A general qml.Rot unitary is applied to one-side of a Bell state creating a general parameterization of all maximally entangled states.

Parameters:
  • settings (list[float]) – A list with three elements parameterizing a general single-qubit unitary

  • wires (qml.Wires) – The two wires on which the maximally entangled state is prepared.

qnetvo.nonmax_entangled_state(settings, wires)[source]

Initializes a nonmaximally entangled GHZ-like state that has a bias between its two outcomes. The state takes the form

\[|\psi_\theta\rangle = \cos(\frac{\theta}{2})|0\dots 0\rangle + \sin(\frac{\theta}{2})|1 \dots 1\rangle\]
Parameters:
  • settings (list[float]) – A list of length 1 containing paraameter \(\theta\)

  • wires (list[int] or qml.Wires) – A list of wires to prepare the nonmaximally entangled GHZ-like state.

qnetvo.graph_state_fn(edges)[source]

Constructs a quantum function that prepares a graph state where each qubit wire is a vertex and the edge are tuple pairs of interacting wires. A graph state takes the form

\[|\psi^G \rangle = \prod_{(a,b) \in Edges} CZ^{(a,b)} |+\rangle^{\otimes N}\]

where \(N\) is the number of qubits, \(|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\), \((a,b)\) is a pair of wires defining an edge, and \(CZ^{(a,b)}\) is a controlled-phase operation operating upon the qubit pair \((a,b)\). For more details, see the qml.CZ() function in the PennyLane docs.

Parameters:

edges – A list of qubit pair tuples defining the wires to which controlled-phase operations are applied.

Returns:

A quantum circuit graph_state(settings, wires) that prepares the specified graph state. Note that wires must contain all qubits specified in edges.

Return type:

Function

qnetvo.W_state(settings, wires)[source]

Initializes the three-qubit \(W\)-state on the specified wires.

\[|\psi^W\rangle = \frac{1}{\sqrt{3}}(|100\rangle + |010\rangle + |001 \rangle)\]
Parameters:
  • settings (list[empty]) – A placeholder parameter that is not used.

  • wires (qml.Wires) – The wires on which the \(W\)-state is prepared.

qnetvo.shared_coin_flip_state(settings, wires)[source]

Initializes a state that mirrors a biased coin flip shared amongst the qubits on wires[0:-1] where wires[-1] is an ansatz used to generate shared randomness.

The shared coin flip is represented by the density matrix.

\[\rho_\theta = \cos^2(\frac{\theta}{2})|0\dots 0\rangle\langle 0 \dots 0| + \sin^2(\frac{\theta}{2})|1\dots 1 \rangle \langle 1 \dots 1|\]
Parameters:
  • settings (list[float]) – A list of 1 real value.

  • wires (qml.Wires) – The wires used to prepare the shaared coin flip state. Note that the last wire is used as an ancilla.

Unitary Layers

qnetvo.local_RY(settings, wires)[source]

Performs a rotation about \(y\)-axis on each qubit specified by wires.

Parameters:
  • settings (list[float]) – A list of len(wires) real values.

  • wires (qml.Wires) – The wires on which the rotations are applied.

qnetvo.local_RXRY(settings, wires)[source]

Performs a rotation about the \(x\) and \(y\) axes on each qubit specified by wires.

Parameters:
  • settings (list[float]) – A list of 2*len(wires) real values.

  • wires (qml.Wires) – The wires on which the rotations are applied.

qnetvo.local_Rot(settings, wires)[source]

Performs an arbitrary qubit unitary as defined by qml.Rot() on each qubit specified by wires. For more details on qml.Rot() please refer to the PennyLane docs.

Parameters:
  • settings (list[float]) – A list of 3 * len(wires) real values.

  • wires (qml.Wires) – The wires to which the qubit unitaries are applied.

Noise Models

qnetvo.pure_amplitude_damping(noise_params, wires)[source]

Implements a single qubit amplitude damping channel as a two-qubit gate.

This allows amplitude damping noise to be applied on quantum hardware or on a state-vector simulator such as "default.qubit".

This method is equivalent to the pennylane.AmplitudeDamping method. The corresponding Kraus operators are expressed as:

\[\begin{split}K_0 = \begin{pmatrix}1 & 0 \\ 0 & \sqrt{1-\gamma} \end{pmatrix}, \quad K_1 = \begin{pmatrix}0 & \sqrt{\gamma} \\ 0 & 0 \end{pmatrix}.\end{split}\]
Parameters:
  • noise_params (List[Float]) – The parameter [gamma] quantifying the amount of amplitude damping noise.

  • wires (qml.Wires) – Two wires on which to implement the amplitude damping channel. The channel input and output is on wires[0] while wires[1] serves as the ancilla register.

qnetvo.pure_phase_damping(noise_params, wires)[source]

Implements a single qubit phase damping channel as a two-qubit gate.

This allows phase damping noise to be applied on quantum hardware or on a state-vector simulator such as "default.qubit".

This method is equivalent to the pennylane.PhaseDamping method. The corresponding Kraus operators are expressed as:

\[\begin{split}K_0 = \begin{pmatrix}1 & 0 \\ 0 & \sqrt{1-\gamma} \end{pmatrix}, \quad K_1 = \begin{pmatrix}0 & 0 \\ 0 & \sqrt{\gamma} \end{pmatrix}.\end{split}\]
Parameters:
  • noise_params (List[Float]) – The parameter [gamma] quantifying the amount of phase damping noise.

  • wires (qml.Wires) – Two wires on which to implement the phase damping channel. The channel input and output is on wires[0] while wires[1] serves as the ancilla register.

qnetvo.two_qubit_depolarizing(*params, wires=None, id=None)[source]

Applies a two-qubit depolarizing channel using Kraus operators.

The channel is called as a quantum function two_qubit_depolarizing(gamma, wires)

Parameters:
  • gamma (Float) – The amount of depolarizing noise in the channel.

  • wires (qml.Wires) – Two wires on which to apply the depolarizing noise.

For a noise parameter \(\gamma\), the two-qubit depolarizing noise model is represented by the following function:

\[\mathcal{N}(\rho) = (1-\frac{16}{15}\gamma)\rho + (\frac{16}{15})(\frac{\gamma}{4})) \mathbb{I}\]
Raises:

ValueError – if 0 <= gamma <= 1 is not satisfied.

qnetvo.colored_noise(*params, wires=None, id=None)[source]

Applies a two-qubit colored noise channel using Kraus operators.

The channel is called as a quantum function colored_noise(gamma, wires).

Parameters:
  • gamma (Float) – The amount of colored noise in the channel.

  • wires (qml.Wires) – Two wires on which to apply the colored noise.

For the noise parameter \(\gamma\), the colored noise model is represented by the following function:

\[\mathcal{N}(\rho) = (1-\gamma)\rho + \frac{\gamma}{2}(|01\rangle\langle 01| + |10\rangle\langle 10|)\]
Raises:

ValueError – if 0 <= gamma <= 1 is not satisfied.