vqc_lite.experiments package

Submodules

vqc_lite.experiments.expressibility module

class vqc_lite.experiments.expressibility.Expressibility_Evaluation(circuit, **kwargs)

Bases: object

Expressibility is a popular descriptor of VQCs. It compares the output statevectors of a VQC with Haar random states of the corresponding Hilbert space. It is computed as the KL-divergence between two histograms. For more details, please refer to:

Reference: Expressibility and entangling capability of parameterized quantum circuits for hybrid quantum-classical algorithms. S. Sim et al. arXiv: 1905.10876

Parameters
  • circuit (Circuit object from circuit_stack or Circuit_P object from circuit_stack_pennylane (recommended)) – the VQC to be evaluated

  • n_samples (int) – the number of pairs of statevectors to sample, 10000 by default

  • n_bins (int) – the number of bins for the histogram, 75 by default

  • seed (jax random seed) – the random seed for the initialization of parameters, 1 by default

  • parameter_bounds ([float, float]) – the interval in which parameters are sampled, [0, 1] by default

run()

Call this function to start the task.

vqc_lite.experiments.state_preparation module

class vqc_lite.experiments.state_preparation.Compression_Adam(psi_target, circuit, **kwargs)

Bases: object

The goal of compression is to iteratively optimize the parameters of the VQC, such that it outputs a statevector with high fidelity compared to the target state.

This task uses Adam optimizer, a popular gradient based optimization method for machine learning and optimization.

Parameters
  • psi_target ((jax) numpy array in tensor shape) – The target state to prepare

  • circuit (Circuit object from circuit_stack or Circuit_P object from circuit_stack_pennylane (recommended)) – the VQC to be trained for state preparation

  • steps (int) – the maximal number of optimization iterations, 1e3 by default

  • lr (float) – the learning rate

  • lf (float) – the loss function. See circuit.py from circuit_stack or circuit_stack_pennylane

  • seed (jax random seed) – the random seed for the initialization of parameters, 1 by default

  • init_params ((jax) numpy array) – initial values for the parameterized gates, None by default and random initialization will be triggered.

initialize_params()

Initialize a filled_circuit with Haar random unitaries.

run()

Call this function to start the task.

class vqc_lite.experiments.state_preparation.Compression_Sweeping(psi_target, circuit, **kwargs)

Bases: object

The goal of compression is to iteratively optimize the parameters of the VQC, such that it outputs a statevector with high fidelity compared to the target state.

This task uses a sweeping optimization method, inspired by some tensor network techniques. Ref. Real- and Imaginary-Time Evolution with Compressed Quantum Circuits. PRX Quantum 2, 010342

Parameters
  • psi_target ((jax) numpy array in tensor shape) – The target state to prepare

  • circuit (Circuit object from circuit_stack. Usage with circuit_stack_Pennylane is not supported) – the VQC to be trained for state preparation

  • steps (int) – the maximal number of optimization iterations, 1e3 by default

  • ea (float) – the maximal absolute error before stopping the optimization, 1e-10 by default

  • er (float) – the maximal relative error before stopping the optimization, 1e-10 by default

  • seed (jax random seed) – the random seed for the initialization of parameters, 1 by default

  • init_filled_circuit (list of (jax) numpy arrays or None) – initial values for the parameterized gates, None by default and random initialization will be triggered.

run()

Call this function to start the task.

Module contents