From: miha-q <> Date: Thu, 15 Aug 2024 00:41:07 +0000 (-0400) Subject: Wed Aug 14 08:41:07 PM EDT 2024 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=a336e6520d5b88badc180b1b8e4ec4e224eb65d9;p=QAnsel.git Wed Aug 14 08:41:07 PM EDT 2024 --- diff --git a/src/bytecode.h b/src/bytecode.h index 71af0f2..50b0ee7 100644 --- a/src/bytecode.h +++ b/src/bytecode.h @@ -26,6 +26,24 @@ typedef struct int use_ifop; } QBytecode; +/* + IMPORTANT NOTE + + (AB)^T = (A^T)(B^T) + + In quantum mechanics, if the relative state is S, then evolving + the relative state by a logic gate A requires computing AS. + + This is inefficient as S is a column vector and it is more + efficient in terms of caching to use a row vector. Hence, the + simulator does not store S but only S^T. To apply the logic + gate A, it is not AS that needs to be computed but instead + (S^T)(A^T). + + This means all the logic gates stored below are represented + as their transposed equivalents. +*/ + static float Identity[] = { 1, 0, 0, 0, diff --git a/src/imports/welcome.png b/src/imports/welcome.png new file mode 100644 index 0000000..85e112e Binary files /dev/null and b/src/imports/welcome.png differ diff --git a/src/index.html b/src/index.html index 17936d2..24bba2b 100644 --- a/src/index.html +++ b/src/index.html @@ -72,7 +72,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -346,6 +346,11 @@ } } + if (ProgramTrack.STATE[0].length == 0) + { + ret = "qreg q[" + (ProgramTrack.STATE.length - 1) + "];\n"; + ret += "sample q;\n"; + } return ret; }, drag: (e, erase, evt, dodrag) => @@ -875,9 +880,9 @@ $("#run")[0].addEventListener("click", () => { $("[onclick*=screenshot]")[0].style.pointerEvents = "none"; - if (ProgramTrack.STATE[0].length == 0) + if (IstinaEditor.getText().trim().length == 0) { - errorModal("You must place at least one logic gate."); + errorModal("There must be code in the code editor in order to execute the program."); return; } createBlocker(); @@ -959,7 +964,7 @@ $(".modal__container")[0].style.backgroundColor = ""; $(".modal__footer")[0].style.display = ""; } - function menu(cmd) + function menu(cmd, evt) { resetDialog(); $(".program-instr")[0].style.display = "none"; @@ -1045,10 +1050,11 @@ $(".modal__container")[0].style.height = sh + "px"; $(".modal__container")[0].style.paddingBottom = "0px"; $(".modal__container")[0].style.maxWidth = sw + "px"; - $(".modal__container")[0].style.backgroundColor = window.blochPictureMode ? "" : "black"; + var blochPictureMode = evt.button == 2; + $(".modal__container")[0].style.backgroundColor = blochPictureMode ? "" : "black"; $(".modal__footer")[0].style.display = "none"; $("#modal-main-title")[0].innerHTML = "Bloch Sphere Visualizer"; - var h = ""; + var h = ""; $("#modal-main-content")[0].innerHTML = h; $("#modal-main-confirm")[0].style.display = ""; $("#modal-main-cancel")[0].style.display = "none"; @@ -1489,7 +1495,7 @@ }, 100); if (!ismobile) { - window.onresize = function() + window.doResize = function() { var resize = { @@ -1499,6 +1505,21 @@ }; localStorage.setItem("resize", JSON.stringify(resize)); window.location.reload(); + }; + window.isActive = true; + window.queuedResize = false; + window.onblur = function() { window.isActive = false; } + window.onfocus = function() { window.isActive = true; if (window.queuedResize) window.doResize(); } + window.onresize = function() + { + if (window.isActive) + { + window.doResize(); + } + else + { + window.queuedResize = true; + } } var resizeData = localStorage.getItem("resize"); if (resizeData != undefined && resizeData != null) diff --git a/src/src.zip b/src/src.zip index e62a1c3..618ef9d 100644 Binary files a/src/src.zip and b/src/src.zip differ
📂 🧹 💾📊 ▶ 📷🌐🌐 ❓ ⚙