qbench.fourier module#

Functionalities relating specifically to Fourier-discrimination experiments.

This package defines all instructions (components) needed for assembling circuits for benchmarking using Fourier-parametrized family.

The Fourier family of measurements is defined as:

\[\begin{split} U(\varphi) = H \begin{pmatrix} 1&0\\0&e^{i\varphi}\end{pmatrix}H^\dagger \end{split}\]

All components are available as properties of FourierComponents class. The instances of this class can be constructed in such a way that the instructions they provide are compatible with several different quantum devices available on the market.

Additionally, this module provides a function computing optimal discrimination probability for Fourier family of measurements, which is defined as:

\[ p_{U(\varphi)} = \frac12 + \frac14 \lvert 1 - e^{i \varphi}\rvert. \]

class qbench.fourier.FourierComponents(phi, gateset=None)#

Class defining components for Fourier-discrimination experiment.

Parameters:
  • phi (Union[float, Parameter]) – angle defining measurement to discriminate. May be a number or an instance of a Qiskit Parameter. See :qiskit_tutorial:`here <circuits_advanced/01_advanced_circuits.html#Parameterized-circuits>`_ if you are new to parametrized circuits in Qiskit.

  • gateset (Optional[str]) –

    name of the one of the predefined basis gate sets to use. It controls which gates will be used to construct the circuit components. Available choices are:

    • "lucy": gateset comprising gates native to OQC Lucy computer.

    • "rigetti": gateset comprising gates native to Rigetti computers.

    • "ibmq": gateset comprising gates native to IBMQ computers.

    If no gateset is provided, high-level gates will be used without restriction on basis gates.

property state_preparation: Instruction#

Instruction performing transformation \(|00\rangle\) -> Bell state

The corresponding circuit is:

     ┌───┐
q_0: ┤ H ├──■──
     └───┘┌─┴─┐
q_1: ─────┤ X ├
          └───┘
property u_dag: Instruction#

Unitary \(U^\dagger\) defining Fourier measurement.

The corresponding circuit is:

   ┌───┐┌───────────┐┌───┐
q: ┤ H ├┤ Phase(-φ) ├┤ H ├
   └───┘└───────────┘└───┘

Note

This instruction is needed because on actual devices we can only measure in Z-basis. The \(U^\dagger\) unitary changes basis so that subsequent measurement in Z-basis can be considered as performing desired von Neumann measurement to be discriminated from the Z-basis one.

property v0_dag: Instruction#

Instruction corresponding to the positive part of Holevo-Helstrom measurement.

The corresponding circuit is:

   ┌──────────┐┌────────────────┐
q: ┤ Rz(-π/2) ├┤ Ry(-φ/2 - π/2) ├
   └──────────┘└────────────────┘
property v0_v1_direct_sum_dag: Instruction#

Direct sum \(V_0^\dagger\oplus V_1^\dagger\) of both parts of Holevo-Helstrom measurement.

Note

In usual basis ordering, the unitaries returned by this property would be block-diagonal, with blocks corresponding to positive and negative parts of Holevo-Helstrom measurement.

However, Qiskit enumerates basis vectors in reverse, so the produced unitaries are not block-diagonal, unless the qubits are swapped. See accompanying tests to see how it’s done.

The following article contains more details on basis vectors ordering used (among others) by Qiskit: https://arxiv.org/abs/1711.02086

property v1_dag: Instruction#

Instruction corresponding to the negative part of Holevo-Helstrom measurement.

The corresponding circuit is:

   ┌──────────┐┌────────────────┐┌────────┐
q: ┤ Rz(-π/2) ├┤ Ry(-φ/2 - π/2) ├┤ Rx(-π) ├
   └──────────┘└────────────────┘└────────┘
qbench.fourier.discrimination_probability_upper_bound(phi)#

Compute exact upper bound on the probability of discrimination.

Parameters:

phi (Union[float, ndarray]) – angle parametrizing the performed measurement.

Returns:

maximum probability with which identity and \(p_{U(\varphi)}\) can be discriminated.

Return type:

Union[float, ndarray]