Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probabilities can be truncated to 0.00000% in stateAsString(true) #86

Open
DanBlackwell opened this issue Apr 11, 2024 · 0 comments
Open

Comments

@DanBlackwell
Copy link

Not necessarily an issue - perhaps an enhancement though. Due to the truncation (or maybe rounding - haven't looked behind the scenes) some probabilities (as well as vector values) for viable states end up being output as 0.

Example program:

const QuantumCircuit = require('quantum-circuit');

let qc = new QuantumCircuit();
let qasm = "OPENQASM 2.0;\n" +
           "include \"qelib1.inc\";\n" +
           "qreg r1[1];\n" +
           "rx(0.0000000001) r1;\n";

qc.importQASM(qasm, (error) => {
    qc.run();
    console.log(qc.stateAsString(true));
})

Output:

 1.00000000+0.00000000i|0>	100.00000%
 0.00000000+0.00000000i|1>	  0.00000%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant