BaseAnsatz#

class pyqit.ansatzes.BaseAnsatz(n_qubits: int, n_layers: int = 1)[source]#

Bases: _PyQitObject

Base class for a parameterized quantum circuit block.

abstractmethod build_circuit(weights)[source]#

The actual PennyLane circuit logic.

Parameters:

weights – Trainable parameters.

get_circuit_func()[source]#

Returns the bound method to be passed to a QNode.

abstractmethod get_weight_shapes() → dict[source]#

Returns the shape of trainable weights required by this ansatz. Used by wrappers to initialize parameters.

Returns:

e.g., {“weights”: (n_layers, n_qubits, 3)}

Return type:

dict