qleet.examples package

Submodules

qleet.examples.qaoa_maxcut module

Implements an example of QAOA for Max Cut. Allows the user to analyze QAOA with easy setup.

class qleet.examples.qaoa_maxcut.MaxCutMetric(graph)[source]

Bases: MetricSpecifier

The metric for the Max Cut problem, generates using a classical process.

from_density_matrix(density_matrix: numpy.ndarray) float[source]

Computes the vector from the samples vector output from the quantum circuit. :type density_matrix: np.array, 2-D matrix of size (2^n, 2^n) :param density_matrix: The 2-D density matrix to generate the output metric :returns: The value of the max-cut :rtype: float :raises NotImplemetedError: Computing from density-matrix is not implemented yet

from_samples_vector(samples_vector: numpy.ndarray) float[source]

Computes the vector from the samples vector output from the quantum circuit. :type samples_vector: np.array, 2-D matrix of size (num_samples, n) :param samples_vector: num_samples measurements each of size n, as a 2-D matrix :returns: The value of the max-cut :rtype: float

from_state_vector(state_vector: numpy.ndarray) float[source]

Computes the vector from the samples vector output from the quantum circuit. :type state_vector: np.array, 2-D matrix of size (2^n,) :param state_vector: The 2-D state vector to generate the output metric :returns: The value of the max-cut :rtype: float :raises NotImplemetedError: Computing from density-matrix is not implemented yet

class qleet.examples.qaoa_maxcut.QAOACircuitMaxCut(graph: Optional[Graph] = None, p: int = 2)[source]

Bases: object

The class to specify a QAOA circuit and metric for computing Max Cut of a graph.

solve_classically()[source]

Solve the combinatorial problem using a full, exponentially sized search :return: Value of the max the cut :rtype: float

Module contents