qleet.simulators package
Submodules
qleet.simulators.circuit_simulators module
Module to draw samples from the circuit. Used for computing properties of the circuit like Entanglability and Expressibility.
- class qleet.simulators.circuit_simulators.CircuitSimulator(circuit: CircuitDescriptor, noise_model: Optional[Union[cirq.devices.noise_model.NoiseModel, qiskit.providers.aer.noise.NoiseModel, pyquil.noise.NoiseModel]] = None)[source]
Bases:
object
The interface for users to execute their CircuitDescriptor objects
- property result: Optional[numpy.ndarray]
Get the results stored from the circuit simulator :return: stored result of the circuit simulation if it has been performed, else None. :rtype: np.array or None
- simulate(param_resolver: Dict[qiskit.circuit.Parameter, float], shots: int = 1024) numpy.ndarray [source]
Simulate to get the state vector or the density matrix :type param_resolver: Dict to resolve all parameters to a static float value :param param_resolver: a dictionary of all the symbols/parameters mapping to their values :type shots: int :param shots: number of times to run the qiskit density matrix simulator :returns: state vector or density matrix resulting from the simulation :rtype: np.array :raises NotImplementedError: if circuit simulation is not supported for a backend
qleet.simulators.pqc_trainer module
The module which houses the Parametrized Quantum Circuit trainer class.
It generates the TensorFlow Quantum model, and allows Keras like API to train and evaluate a model.
- class qleet.simulators.pqc_trainer.PQCSimulatedTrainer(circuit: CircuitDescriptor)[source]
Bases:
object
A class to train parametrized Quantum Circuits in Tensorflow Quantum Uses gradient descent over the provided parameters, using the TFQ Adjoin differentiator.
- evaluate(n_samples: int = 1000) float [source]
Evaluates the Parametrized Quantum Circuit. :type n_samples: int :param n_samples: The number of samples to evaluate the circuit over :returns: The average loss of the circuit over all the samples :rtype: float
- train(n_samples=100, loggers: Optional[AnalyzerList] = None) tensorflow.keras.Model [source]
Trains the parameter of the circuit to minimize the loss. :type n_samples: int :param n_samples: Number of samples to train the circuit over :type loggers: AnalyzerList :param loggers: The AnalyzerList that tracks the training of the model :returns: The trained model :rtype: tf.keras.Model