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.

AnsatzBlock

Ansatz block.

OneQubitAnsatzBlock

One-qubit ansatz block.

TwoQubitAnsatzBlock

Two-qubit ansatz block.

ZXZ

One-qubit ansatz block based on the ZXZ decomposition.

KAK

Two-qubit ansatz block based on the KAK decomposition.

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

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.