The current version of the qasm printing helper function has a quadratic scaling because it is iterating over the circuit every time an operation is called. By instead storing the operations as a list at the beginning of the function, this allows for instantaneous lookup while retaining the same functionality.
This is largely untested as a fix beyond viewing the file size and structure of the files, so please exercise caution before merging. The output from the circuit generators seems to be non-deterministic and when I tried reading the file into cirq by reading the file and translating the string to cirq, I get an error QasmException: Unknown gate "reset" at line 7. I tried finding a built in circuit reader in case I was making a mistake, but couldn't find one.
The current version of the qasm printing helper function has a quadratic scaling because it is iterating over the circuit every time an operation is called. By instead storing the operations as a list at the beginning of the function, this allows for instantaneous lookup while retaining the same functionality.
This is largely untested as a fix beyond viewing the file size and structure of the files, so please exercise caution before merging. The output from the circuit generators seems to be non-deterministic and when I tried reading the file into cirq by reading the file and translating the string to cirq, I get an error
QasmException: Unknown gate "reset" at line 7
. I tried finding a built in circuit reader in case I was making a mistake, but couldn't find one.