Skip to content

EfficientSU2

A builder for the EfficientSU2 ansatz

Source code in q3as/algo/vqe.py
class EfficientSU2:
    """
    A builder for the EfficientSU2 ansatz
    """

    def __init__(self, postprocess: _PostProcessCallable = None, **kwargs):
        """
        Create a new EfficientSU2 builder. Arguments are passed to the EfficientSU2 constructor in the Qiskit circuit library.
        """
        self.postprocess = postprocess
        self.kwargs = kwargs

    def __call__(self, obs: ObservablesArray) -> QuantumCircuit:
        ansatz = EfficientSU2Ansatz(
            _observables_to_pauli(obs).num_qubits, **self.kwargs
        )
        if self.postprocess is not None:
            ansatz = self.postprocess(ansatz)
        return ansatz

__init__(postprocess=None, **kwargs)

Create a new EfficientSU2 builder. Arguments are passed to the EfficientSU2 constructor in the Qiskit circuit library.

Source code in q3as/algo/vqe.py
def __init__(self, postprocess: _PostProcessCallable = None, **kwargs):
    """
    Create a new EfficientSU2 builder. Arguments are passed to the EfficientSU2 constructor in the Qiskit circuit library.
    """
    self.postprocess = postprocess
    self.kwargs = kwargs