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.
Ansatz block. |
|
One-qubit ansatz block. |
|
Two-qubit ansatz block. |
|
One-qubit ansatz block based on the ZXZ decomposition. |
|
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
) – IfTrue
, 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 theParameterVector
representing the free parameters in the returned ansatz circuit.
- Return type:
- Returns:
(ansatz, parameter_values)
such thatansatz.assign_parameters(parameter_values)
is equivalent toqc
up to a global phase.