pygsti.tools.edesigntools.calculate_fisher_information_matrix

pygsti.tools.edesigntools.calculate_fisher_information_matrix#

calculate_fisher_information_matrix(model, circuits, num_shots=1, term_cache=None, regularization=1e-08, approx=False, mem_efficient_mode=False, circuit_chunk_size=100, verbosity=1, comm=None, mem_limit=None)#

Calculate the Fisher information matrix for a set of circuits and a model.

Parameters:
  • model (OpModel) – The model used to calculate the terms of the Fisher information matrix.

  • circuits (list) – List of circuits in the experiment design.

  • num_shots (int or dict) – If int, specifies how many shots each circuit gets. If dict, keys must be circuits and values are per-circuit counts.

  • term_cache (dict or None) – If provided, should have circuits as keys and per-circuit Fisher information matrices as values, i.e. the output of calculate_fisher_information_per_circuit(). This cache will be updated with any additional circuits that need to be calculated in the given circuit list.

  • regularization (float, optional (default 1e-8)) – A regularization parameter used to set a minimum probability value for circuits. This is needed to avoid division by zero problems in the fisher information calculation.

  • approx (bool, optional (default False)) – When set to true use the approximate fisher information where we drop the hessian term. Significantly faster to compute than when including the hessian.

  • mem_efficient_mode (bool, optional (default False)) – If true avoid constructing the intermediate term cache to save on memory.

  • circuit_chunk_size – Used in conjunction with mem_efficient_mode. This sets the maximum number of circuits to simultaneously construct the per-circuit contributions to the fisher information for at any one time.

  • int – Used in conjunction with mem_efficient_mode. This sets the maximum number of circuits to simultaneously construct the per-circuit contributions to the fisher information for at any one time.

  • 100) (optional (default) – Used in conjunction with mem_efficient_mode. This sets the maximum number of circuits to simultaneously construct the per-circuit contributions to the fisher information for at any one time.

  • verbosity (int, optional (default 1)) – Used to control the level of output printed by a VerbosityPrinter object.

  • comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator for distributing the computation across multiple processors.

  • mem_limit (int, optional) – A rough memory limit in bytes which is used to determine job allocation when there are multiple processors.

Returns:

fisher_information – Fisher information matrix of size (num_params, num_params)

Return type:

numpy.ndarray