GenericLayerAnsatz¶
- class GenericLayerAnsatz(gate_sequence, entangler=None, entangling_layout=None)[source]¶
Bases:
AnsatzA flexible ansatz alternating single-qubit gates with optional entanglers.
- Parameters:
gate_sequence (
Sequence[type[Gate]]) – Sequence of one-qubit QiskitGatesubclasses (e.g.,RYGate,RZGate).entangler (
type[Gate] |None) – Two-qubit QiskitGatesubclass (e.g.,CXGate,CZGate). If None, no entanglement is applied.entangling_layout (
Literal['linear','brick','circular','all-to-all'] |Sequence[tuple[int,int]] |None) – Layout for entangling layer (“linear”, “all-to-all”, etc.).
Methods Summary
build(params, n_qubits, n_layers, **kwargs)Builds the ansatz circuit and returns a list of operations.
n_params_per_layer(n_qubits, **kwargs)sum(_gate_n_params(g) for g in gate_sequence) * n_qubits.Methods Documentation