pasqal-io / qadence

Digital-analog quantum programming interface
https://pasqal-io.github.io/qadence/latest/
Apache License 2.0
72 stars 21 forks source link

[Testing] Better testing the projectors #224

Open RolandMacDoland opened 1 year ago

RolandMacDoland commented 1 year ago

jpmoutinho 32 minutes ago Oh man those get a bit... verbose 😅. I would suggest mostly testing the projector in terms of expected results coming out of circuits and observables instead of directly comparing matrices. E.g.:

For some random initial state checking that a random projector as a block in the circuit will lead to a unnormalized wavefunction with only a component in the respective basis state. Checking that HamEvo with a generator written with only projectors gives the same result as one written with Paulis (e.g., X_proj = |0><1| + |1><0| and you can similarly rewrite the other paulis with the projectors and build an Hamiltonian out of it). Same thing for using the projectors as the observable in the QuantumModel.

mlahariya commented 2 weeks ago

@RolandMacDoland , @jpmoutinho - Check if this might be duplicated work.