]> foleosoft.com Git - QAnsel.git/commitdiff
Sun 08 Dec 2024 10:36:02 PM EST
authora <[email protected]>
Mon, 9 Dec 2024 03:36:02 +0000 (22:36 -0500)
committera <[email protected]>
Mon, 9 Dec 2024 03:36:02 +0000 (22:36 -0500)
src/index.html

index b87a792d02a7a83c8f446f82b3e7a3722b336102..3814bbe3201c4c6cda17cb9f4638b8ee75e52601 100644 (file)
                                                }
                                                else
                                                {
-                                                       ret += "born q;\n";
+                                                       ret += localStorage.getItem("nmpolicy") + " q;\n";
                                                }
                                        }
                                }
                                if (ProgramTrack.STATE[0].length == 0)
                                {
                                        ret = "qreg q[" + (ProgramTrack.STATE.length - 1) + "];\n";
-                                       ret += "born q;\n";
+                                       ret += localStorage.getItem("nmpolicy") + " q;\n";
                                }
 
                                if (!ret.includes("Duplicate") && !ret.includes("Incomplete") && !ret.includes("born"))
                                                        }
                                                }
                                        }
-                                       ret = "shots " + localStorage.getItem("shots") + ";\n" + ret;
+                                       if (parseInt(localStorage.getItem("shots")) != shotsmax)
+                                       {
+                                               ret = "shots " + localStorage.getItem("shots") + ";\n" + ret;
+                                       }
                                }
                                return ret;
                        },
                                localStorage.setItem("hvar", "");
                        if (localStorage.getItem("shots") == null)
                                localStorage.setItem("shots", shotsmax);
+                       if (localStorage.getItem("nmpolicy") == null)
+                               localStorage.setItem("nmpolicy", "born");
                        ProgramTrack.draw();
                        //$(".program-track")[0].parentNode.style.height = Math.round($(".program-instr")[0].getBoundingClientRect().height) + "px";
                        $(".program-track")[0].parentNode.style.width = "100%";
                                        $("#modal-main-content")[0].innerHTML = `
                                                <p>API key: </p><input type='text' id='apikey' />
                                                <br />
-                                               <p>Shots: <p/><input type='number' id='shots' step='1' />
+                                               <p>Shots: </p><input type='number' id='shots' step='1' />
+                                               <br />
+                                               <p>Noise: </p><input type='number' id='noise' step='0.01' />
                                                <br />
-                                               <p>Noise: <p/><input type='number' id='noise' step='0.01' />
+                                               <p>No-Measurement Policy: </p>
+                                                       <select id='nmpolicy'>
+                                                               <option value='born'>Born Rule</option>
+                                                               <option value='sample'>Sample Qubits</option>
+                                                       </select>
                                                <br />
-                                               <p>Hidden variable: <p/><input type='number' id='hvar' step='0.01' />
+                                               <p>Hidden variable: </p><input type='number' id='hvar' step='0.01' />
                                        `;
                                        $("#apikey")[0].style.width = "100%";
                                        $("#noise")[0].style.width = "100%";
                                        $("#hvar")[0].style.width = "100%";
                                        $("#shots")[0].style.width = "100%";
+                                       $("#nmpolicy")[0].style.width = "100%";
                                        $("#apikey")[0].addEventListener("click", () =>
                                        {
                                                $("#apikey")[0].selectionStart = 0;
                                        $("#noise")[0].value = localStorage.getItem("noise");
                                        $("#hvar")[0].value = localStorage.getItem("hvar");
                                        $("#shots")[0].value = localStorage.getItem("shots");
+                                       $("#nmpolicy")[0].value = localStorage.getItem("nmpolicy");
                                        $("#modal-main-confirm")[0].style.display = "";
                                        $("#modal-main-cancel")[0].style.display = "";
                                        $("#modal-main-confirm")[0].setAttribute("onclick",
                                                localStorage.setItem('noise', $('#noise')[0].value);
                                                localStorage.setItem('hvar', $('#hvar')[0].value);
                                                localStorage.setItem('shots', $('#shots')[0].value);
+                                               localStorage.setItem('nmpolicy', $('#nmpolicy')[0].value);
                                                closeModal();
                                                ProgramTrack.draw();
                                        `);