German
Sprachen
English
Japanese
German
Korean
Shortcuts

qiskit.ignis.verification.QVFitter

class QVFitter(backend_result=None, statevector_result=None, qubit_lists=None)[Quellcode]

Class for fitters for quantum volume.

Parameter
  • backend_result (list) – list of results (qiskit.Result).

  • statevector_result (list) – the ideal statevectors of each circuit

  • qubit_lists (list) – list of qubit lists (what was passed to the circuit generation)

__init__(backend_result=None, statevector_result=None, qubit_lists=None)[Quellcode]
Parameter
  • backend_result (list) – list of results (qiskit.Result).

  • statevector_result (list) – the ideal statevectors of each circuit

  • qubit_lists (list) – list of qubit lists (what was passed to the circuit generation)

Methods

__init__([backend_result, …])

param backend_result

list of results (qiskit.Result).

add_data(new_backend_result[, rerun_fit])

Add a new result.

add_statevectors(new_statevector_result)

Add the ideal results and convert to the heavy outputs.

calc_confidence_level(z_value)

Calculate confidence level using z value.

calc_data()

Make a count dictionary for each unique circuit from all the results.

calc_statistics()

Convert the heavy outputs in the different trials into mean and error for plotting.

calc_z_value(mean, sigma)

Calculate z value using mean and sigma.

plot_hop_accumulative(depth[, ax, figsize])

Plot individual and accumulative heavy output probability (HOP) as a function of number of trials.

plot_qv_data([ax, show_plt, figsize, …])

Plot the qv data as a function of depth

plot_qv_trial(depth, trial_index[, figsize, ax])

Plot individual trial.

quantum_volume()

Return the volume for each depth.

qv_success()

Return whether each depth was successful (> 2/3 with confidence level > 0.977 corresponding to z_value = 2) and the confidence level.

Attributes

depths

Return depth list.

heavy_output_counts

Return the number of heavy output counts as measured.

heavy_output_prob_ideal

Return the heavy output probability ideally.

heavy_outputs

Return the ideal heavy outputs dictionary.

qubit_lists

Return depth list.

results

Return all the results.

ydata

Return the average and std of the output probability.

add_data(new_backend_result, rerun_fit=True)[Quellcode]

Add a new result. Re calculate fit

Parameter
  • new_backend_result (list) – list of qv results

  • rerun_fit (bool) – re calculate the means and fit the result

Verursacht

QiskitError – If the ideal distribution isn’t loaded yet

Additional information:

Assumes that ‚result‘ was executed is the output of circuits generated by qv_circuits,

add_statevectors(new_statevector_result)[Quellcode]

Add the ideal results and convert to the heavy outputs.

Assume the result is from ‚statevector_simulator‘

Parameter

new_statevector_result (list) – ideal results

Verursacht

QiskitError – If the result has already been added for the circuit

calc_confidence_level(z_value)[Quellcode]

Calculate confidence level using z value.

Accumulative probability for standard normal distribution in [-z, +infinity] is 1/2 (1 + erf(z/sqrt(2))), where z = (X - mu)/sigma = (hmean - 2/3)/sigma

Parameter

z_value (float) – z value in in standard normal distibution.

Rückgabe

confidence level in decimal (not percentage).

Rückgabetyp

float

calc_data()[Quellcode]

Make a count dictionary for each unique circuit from all the results.

Calculate the heavy output probability.

Additional information:

Assumes that ‚result‘ was executed is the output of circuits generated by qv_circuits,

calc_statistics()[Quellcode]

Convert the heavy outputs in the different trials into mean and error for plotting.

Here we assume the error is due to a binomial distribution. Error (standard deviation) for binomial distribution is sqrt(np(1-p)), where n is the number of trials (self._ntrials) and p is the success probability (self._ydata[0][depthidx]/self._ntrials).

calc_z_value(mean, sigma)[Quellcode]

Calculate z value using mean and sigma.

Parameter
  • mean (float) – mean

  • sigma (float) – standard deviation

Rückgabe

z_value in standard normal distibution.

Rückgabetyp

float

property depths

Return depth list.

property heavy_output_counts

Return the number of heavy output counts as measured.

property heavy_output_prob_ideal

Return the heavy output probability ideally.

property heavy_outputs

Return the ideal heavy outputs dictionary.

plot_hop_accumulative(depth, ax=None, figsize=(7, 5))[Quellcode]

Plot individual and accumulative heavy output probability (HOP) as a function of number of trials.

Parameter
  • depth (int) – depth of QV circuits

  • ax (Axes or None) – plot axis (if passed in).

  • figsize (tuple) – figure size in inches.

Verursacht

ImportError – If matplotlib is not installed.

Rückgabe

A figure of individual and accumulative HOP as a function of number of trials, with 2-sigma confidence interval and 2/3 threshold.

Rückgabetyp

matplotlib.Figure

plot_qv_data(ax=None, show_plt=True, figsize=(7, 5), set_title=True, title=None)[Quellcode]

Plot the qv data as a function of depth

Parameter
  • ax (Axes or None) – plot axis (if passed in).

  • show_plt (bool) – display the plot.

  • figsize (tuple) – Figure size in inches.

  • set_title (bool) – set figure title.

  • title (String or None) – text for setting figure title

Verursacht

ImportError – If matplotlib is not installed.

Rückgabe

A figure of Quantum Volume data (heavy output probability) with two-sigma error bar as a function of circuit depth.

Rückgabetyp

matplotlib.Figure

plot_qv_trial(depth, trial_index, figsize=(7, 5), ax=None)[Quellcode]

Plot individual trial. :param depth: circuit depth :type depth: int :param trial_index: trial index :type trial_index: int :param figsize: Figure size in inches. :type figsize: tuple :param ax: plot axis (if passed in). :type ax: Axes or None

Rückgabe

A figure for histogram of ideal and experiment probabilities.

Rückgabetyp

matplotlib.Figure

quantum_volume()[Quellcode]

Return the volume for each depth.

Rückgabe

List of quantum volumes

Rückgabetyp

list

property qubit_lists

Return depth list.

qv_success()[Quellcode]

Return whether each depth was successful (> 2/3 with confidence level > 0.977 corresponding to z_value = 2) and the confidence level.

Rückgabe

List of list of 2 elements for each depth: - success True/False - confidence level

Rückgabetyp

list

property results

Return all the results.

property ydata

Return the average and std of the output probability.