qermit.spectral_filtering#

spectral_filtering.gen_spectral_filtering_MitEx(n_vals: int, **kwargs) MitEx#

Generator function for the spectral filtering MitEx. This method acts on symbolic circuits, evaluating the circuit on a grid of symbol values and performing mitigation on the resulting landscape.

Parameters:
  • backend (Backend) – Backend on which all experiments are run.

  • n_vals (int) – The number of values each symbol should take. Each symbol will take n_vals equally spaced values in the range \([0, 2 U+03C0]\). The circuit will be evaluate at every permutation of the symbols evaluated at these points, giving a grid of circuit evaluations.

Key signal_filter:

Method for filtering the landscape of circuit evaluations. Defaults to SmallCoefficientSignalFilter.

Returns:

MitEx implementing spectral filtering.

Return type:

MitEx

spectral_filtering.gen_result_extraction_task() MitTask#

Generates task which extracts a result at coordinates specified by symbol values from grid of results.

Returns:

Task interpolating results.

Return type:

MitTask

spectral_filtering.gen_mitigation_task() MitTask#

Generates task acting signal_filter on the fourier coefficients of a grid of results.

Parameters:

signal_filter (SignalFilter) – Method of filtering the signal.

Returns:

Task performing filtering.

Return type:

MitTask

spectral_filtering.gen_fft_task() MitTask#

Generates task which performs Fast Fourier Transform of grids of values.

Returns:

Task performing Fast Fourier Transform

Return type:

MitTask

spectral_filtering.gen_ndarray_to_dict_task() MitTask#

Generates task reshaping an array of QubitPauliOperator into a dictionary with QubitPauliStrings as keys and an array of the appropriate coefficients as values.

Returns:

Task reshaping QubitPauliOperator into a dictionary with QubitPauliStrings as keys and an array of the appropriate coefficients as values.

Return type:

MitTask

spectral_filtering.gen_inv_fft_task() MitTask#

Generates task performing the inverse Fast Fourier Transform on each value in the list of dictionaries.

Returns:

Task performing Fast Fourier Transform.

Return type:

MitTask

spectral_filtering.gen_flatten_task() MitTask#

Generates task which transforms a list of ndarrays of ObservableExperiments into a list of ObservableExperiments. These ObservableExperiments can then be run in sequence.

Returns:

Generates task which transforms a list of ndarrays of ObservableExperiments into a list of ObservableExperiments

Return type:

MitTask

spectral_filtering.gen_reshape_task() MitTask#

Generates task which reshapes a list of QubitPauliOperator into a list of ndarrays of QubitPauliOperator. This can be used to have the effect for reversing the task generated by gen_flatten_task.

Returns:

Task which reshapes a list of QubitPauliOperator into a list of ndarrays of QubitPauliOperator.

Return type:

MitTask

spectral_filtering.gen_obs_exp_grid_gen_task() MitTask#

Generates task creating an ObservableExperiment for each point in the input meshgrid.

Returns:

Task generating grid of experiments.

Return type:

MitTask

spectral_filtering.gen_symbol_val_gen_task() MitTask#

Generates task which produces a grid of values. The values are generated uniformly in the interval [0,2] (factors of pi give full coverage of the Bloch sphere) for each symbol. The points on the grid are equally spaces, and the number of values is the same in each dimension. In the context of the spectral filtering MitEx, the given circuit will be evaluated at each point in the grid. This is to say that the symbols in the circuit will be substituted for the values at each point in the grid.

Parameters:

n_sym_vals (int) – The number of values to be taken by each symbol in the circuit.

Returns:

Task generating grid of symbol values.

Return type:

MitTask

spectral_filtering.gen_wire_copy_task(n_wire_copies: int) MitTask#

Generates task which copies each of the input wires n_wire_copies times. The output wires are repeated in the same order as the input wires. This is to say that input wires 1,2,…n will be outputted as 1,2,…,n,…,1,2,…n.

Parameters:
  • n_in_wires (int) – The number of wires input into this task.

  • n_wire_copies (int) – The number of times the wires are to be copied.

Returns:

Task which coppies input wires.

Return type:

MitTask

spectral_filtering.gen_param_grid_gen_task() MitTask#

Generates task converting lists of symbol values into a meshgrid.

Returns:

Task converting list of symbol values into a meshgrid.

Return type:

MitTask

class qermit.spectral_filtering.signal_filter.SmallCoefficientSignalFilter(tol: float)[source]#

Child class of SignalFilter which filters results by reducing small Fourier coefficients to 0.

filter(fft_result_val_grid: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]][source]#

Filter method reducing values in fft_result_val_grid to 0 if they are less than tol.

Parameters:

fft_result_val_grid (NDArray[float]) – Grid of values.

Returns:

Grid of values with values less than tol reduced to 0.

Return type:

NDArray[float]

class qermit.spectral_filtering.signal_filter.SignalFilter[source]#

Base class for signal filtering.

abstract filter(fft_result_val_grid: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]][source]#

Method transforming array of floats into filtered array of floats.