Skip to main contentIBM Quantum Documentation

Ansatz generation

qiskit_addon_aqc_tensor.ansatz_generation

Utility for generating a general, parametrized, ansatz circuit which matches the two-qubit connectivity of an input circuit.

AnsatzBlockAnsatz block.
OneQubitAnsatzBlockOne-qubit ansatz block.
TwoQubitAnsatzBlockTwo-qubit ansatz block.
ZXZOne-qubit ansatz block based on the ZXZ decomposition.
KAKTwo-qubit ansatz block based on the KAK decomposition.

generate_ansatz_from_circuit

generate_ansatz_from_circuit(qc, /, *, qubits_initially_zero=False, parameter_name='theta')[source]

GitHub

Generate an ansatz from the two-qubit connectivity structure of a circuit.

See explanatatory material for motivation.

Parameters

  • qc (QuantumCircuit) – A circuit, which is assumed to be unitary. Barriers are ignored.
  • qubits_initially_zero (bool) – If True, the first Z rotation on each qubit is removed from the ansatz under the assumption that it has no effect.
  • parameter_name (str) – Name for the ParameterVector representing the free parameters in the returned ansatz circuit.

Return type

tuple[QuantumCircuit, list[float]]

Returns

(ansatz, parameter_values) such that ansatz.assign_parameters(parameter_values) is equivalent to qc up to a global phase.

Was this page helpful?
Report a bug or request content on GitHub.