-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
23 lines (20 loc) · 824 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var qeval = new qEvaluator();
function run()
{
document.getElementById("in").value.split("\n").map((x) => qeval.readLine(x));
var res = qeval.run();
var MinNum = 1e-10;
var buff = "";
buff = "States: \n";
buff += res.States.map((x)=>x.toString()).join(".\n");
buff += "Probs: ";
buff += res.Prob.map((x) => Math.abs(x) < MinNum ? 0 : x).join(",");
if (res.measure != undefined) buff += "\nMeasure: " + res.measure.map((x) => Math.abs(x) < MinNum ? 0 : x).map((x) => x.toString()).join(",");
document.getElementById("out").value = buff;
}
window.addEventListener("load", onLoad)
function onLoad()
{
var max = PerformanceEval();
document.getElementById("warning").innerText = "Autodetected that " + max + " qubits is the max your computer can handle."
}