0

I've been studying the VQLS algorithm and came across this Qiskit implementation: https://learn.qiskit.org/course/ch-applications/the-variational-quantum-linear-solver

I'm having trouble understanding the circuit in the “control_fixed_ansatz” function.

I know that we want to estimate the expectation of U^+A_nV(k) on the |0> state using the Hadamard test. So, I was expecting to find the controlled-version of the gates representing these matrices. However, in the ansatz, there are also ccx gates, and I'm not sure why they are used.

I would appreciate any help in understanding this. Thank you in advance!

GloTura
  • 1
  • 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jun 21 '23 at 07:57

1 Answers1

0

I think there is an error in the Qiksit tutorial that may have caused misunderstandings.

The function that builds the circuit to calculate the value <0|U^+ A_nV(k)|0> (so, after the |<b|Psi>|^2) is the "special_had_test". The "control_fixed_ansatz" is a function that builds a circuit that applies the ansatz (with the appropriate parameters), but in a controlled way. This is used in the "special_had_test" where V(k), A_n and U need to be applied as controlled gates in the Hadamard Test to obtain the values <0|U^+ A_nV(k)|0>.

Therefore, the circuit in the "control_fixed_ansatz" is a controlled gate of the specific "apply_fixed_ansatz". I haven't done it, but you could test if the "control_fixed_ansatz" circuit applies the fixed ansatz, like the "apply_fixed_ansatz", on the corresponding qubits if the ancilla qubit is 1.

inamrr
  • 1
  • 1