Adding a New Ansatz ==================== To add a new ansatz, inherit from ``BaseAnsatz``: .. code-block:: python from psipose.ansatze._base import BaseAnsatz import pennylane as qml class MyAnsatz(BaseAnsatz): """My custom ansatz.""" def __init__(self, layers=2): self.layers = layers @classmethod def weight_shape(cls, n_qubits): """Return shape of weight tensor.""" return (layers, n_qubits, 3) # example def circuit(self, weights, wires): """Apply ansatz circuit with given weights.""" for layer in range(self.layers): for i, wire in enumerate(wires): qml.Rot(*weights[layer, i], wires=wire)