ngnrsaa / qflex

Flexible Quantum Circuit Simulator (qFlex) implements an efficient tensor network, CPU-based simulator of large quantum circuits.
Apache License 2.0
97 stars 24 forks source link

Fix circuit.load() #227

Closed alankao64 closed 4 years ago

alankao64 commented 4 years ago

Bug in circuit.load().

In read_circuit_test.cpp, ReadCircuitTest, CircuitReferencingInactiveQubits: circuit.load(std::stringstream(kBad_Gate)) is not updating the circuit, so circuit_data_to_tensor_network() is getting called on kBadTGate for all tests.

s-mandra commented 4 years ago

@alankao64, I'm running make -j8 && make -j8 run-tests and everything is fine. Is this what I would expect? If not, could you adjust the test to trigger an error, so I can work from that? Thanks!

alankao64 commented 4 years ago

@alankao64, I'm running make -j8 && make -j8 run-tests and everything is fine. Is this what I would expect? If not, could you adjust the test to trigger an error, so I can work from that? Thanks!

Everything should pass, the reason I found this bug is because we wanted to add the gate into the error message, and then I found that circuit.load() wasn't actually updating circuit. I'll adjust the test to fail.

alankao64 commented 4 years ago

@s-mandra the test should be failing now!

s-mandra commented 4 years ago

Everything works now. Thanks for catching this @alankao64!