Expressibility#
Our package allows you estimate the expressiblity of a given model.
model = Model(
n_qubits=2,
n_layers=1,
circuit_type="HardwareEfficient",
)
input_domain, bins, dist_circuit = Expressibility.state_fidelities(
random_key=jax.random.key(1000),
n_samples=200,
n_bins=10,
n_input_samples=5,
input_domain=[0, 2*np.pi],
model=model,
)
Here, n_bins is the number of bins that you want to use in the histogram, n_samples is the number of parameter sets to generate (using the default initialization strategy of the model), n_input_samples is the number of samples for the input domain in \([0, 2\pi]\), and random_key is an optional JAX random key for parameter initialization.
Note that state_fidelities accepts keyword arguments that are being passed to the model call.
This allows you to utilize e.g. caching.
Next, you can calculate the Haar integral (as reference), by
Finally, the Kullback-Leibler divergence allows you to see how well the particular circuit performs compared to the Haar integral: