LuchnikovI / QGOpt

Riemannian optimization for quantum technologies
Apache License 2.0
56 stars 6 forks source link

State preperation #30

Closed ShHsLin closed 4 years ago

ShHsLin commented 4 years ago

This is really a nice work. The library works out smoothly.

One tiny bug I spotted when playing with the example is In the state preparation code, instead of

        loss = 1 - tf.tensordot(psi_out[:, 0], psi_true, axes=1)

one should use,

        overlap = tf.tensordot(tf.math.conj(psi_out[:, 0]), psi_true, axes=1)
        loss = 1 - tf.math.real(overlap)
        ## or consider
        ## 1 - tf.math.real(overlap * tf.math.conj(overlap))  
        ## This is the error in fidelity

At least the conjugate is needed, otherwise, the state obtain would be the conjugation of the target state.

LuchnikovI commented 4 years ago

Thank you for your finding! I fixed this bug.