mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-quantique.git
synced 2026-11-29 07:05:08 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
parent
9202b4acbf
commit
2c137d8e17
22
README.md
22
README.md
@ -1,3 +1,21 @@
|
||||
# ploxion-quantique
|
||||
# 🌀 Quantique
|
||||
|
||||
PLOXION · SENTIR la physique quantique (rs-4, forge Chaoxion) — l'OBSERVATEUR au centre (la machine à veille). 3 modes canvas : SUPERPOSITION (le nuage |ψ|² respire → mesurer l'effondre en un point) · FENTES de Young (interférence qui se construit → observer l'effondre en 2 bandes) · INTRICATION (mesurer un qubit fixe l'autre à l'instant). Déterministe sauf la mesure (vrai hasard). GPU-cheap, reduced-motion. · fournit: quantique, science, physique, visualiseur, observateur
|
||||
SENTIR la physique quantique (rs-4, forge Chaoxion) — l'OBSERVATEUR au centre (la machine à veille). 3 modes canvas : SUPERPOSITION (le nuage |ψ|² respire → mesurer l'effondre en un point) · FENTES de Young (interférence qui se construit → observer l'effondre en 2 bandes) · INTRICATION (mesurer un qubit fixe l'autre à l'instant). Déterministe sauf la mesure (vrai hasard). GPU-cheap, reduced-motion.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `quantique` |
|
||||
| fournit | `quantique` `science` `physique` `visualiseur` `observateur` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSPorts` `jOSQuantum` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/quantique/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=quantique — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre quantique` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||
|
||||
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||
|
||||
© 2026 chill-tekk · ne pas nuire
|
||||
|
||||
232
app.blade.php
Normal file
232
app.blade.php
Normal file
@ -0,0 +1,232 @@
|
||||
{{-- PL0XION quantique 🌀 — SENTIR la physique quantique (rs-4, RS-7 : « il faut sentir la physique
|
||||
quantique »). L'OBSERVATEUR au centre (= la machine à veille, le I dans ON→ION). 3 modes canvas :
|
||||
SUPERPOSITION (le nuage respire → MESURER l'effondre en un point, proba |ψ|²) · FENTES de Young
|
||||
(interférence qui se construit → OBSERVER l'effondre en 2 bandes) · INTRICATION (mesurer un qubit
|
||||
fixe l'autre instantanément). Déterministe sauf la mesure (vrai hasard). GPU-cheap, reduced-motion. --}}
|
||||
<style>
|
||||
.qx{display:flex;flex-direction:column;height:100%;background:#05060e;color:#dfe7ff;font-family:var(--xr-font-ui,ui-sans-serif,system-ui);overflow:hidden}
|
||||
.qx__h{flex:0 0 auto;display:flex;gap:6px;align-items:center;padding:8px 11px;border-bottom:1px solid #17203c;flex-wrap:wrap}
|
||||
.qx__h b{color:#8fb6ff;font-weight:800;margin-right:6px}
|
||||
.qx__tab{cursor:pointer;background:rgba(30,42,74,.5);border:1px solid #24345c;color:#cdd8f5;border-radius:8px;padding:5px 11px;font:inherit;font-size:.76rem}
|
||||
.qx__tab.on{background:linear-gradient(90deg,#6a8dff,#b06aff);color:#040814;border:0;font-weight:800}
|
||||
.qx__stage{flex:1;min-height:0;position:relative}
|
||||
.qx__stage canvas{width:100%;height:100%;display:block}
|
||||
.qx__bar{flex:0 0 auto;display:flex;gap:9px;align-items:center;padding:9px 12px;border-top:1px solid #17203c;flex-wrap:wrap}
|
||||
.qx__btn{cursor:pointer;border:0;border-radius:9px;background:linear-gradient(90deg,#6a8dff,#b06aff);color:#040814;font:inherit;font-weight:800;font-size:.8rem;padding:8px 15px}
|
||||
.qx__btn.sec{background:rgba(30,42,74,.7);color:#cdd8f5;border:1px solid #2a3a62;font-weight:600}
|
||||
.qx__btn.sec.on{background:#ff8a5c;color:#1a0a04;border:0}
|
||||
.qx__lab{font-size:.72rem;color:#8b9bc8}
|
||||
.qx__lab b{color:#b9c8ff}
|
||||
.qx input[type=range]{accent-color:#8f7bff}
|
||||
.qx__msg{font-size:.72rem;color:#9fb0e0;margin-left:auto;text-align:right;max-width:55%}
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var TAU = Math.PI * 2;
|
||||
var LIVE = null; // posé au mount : {mode:function()}
|
||||
function describe() {
|
||||
var m = LIVE ? LIVE.mode() : 'sup';
|
||||
var LBL = { sup: 'superposition', slit: 'fentes de Young', ent: 'intrication', circ: 'circuit → QPU' };
|
||||
return { v: 1, id: 'quantique', title: 'Quantique', icon: '🌀', items: [
|
||||
{ p: 1, kind: 'stat', label: 'mode', value: LBL[m] || m }
|
||||
] };
|
||||
}
|
||||
|
||||
function mount(container) {
|
||||
var reduce = false; try { reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; } catch (e) {}
|
||||
container.innerHTML = '<div class="qx"><div class="qx__h"><b>🌀 quantique</b>'
|
||||
+ '<button class="qx__tab on" data-m="sup">superposition</button>'
|
||||
+ '<button class="qx__tab" data-m="slit">fentes de Young</button>'
|
||||
+ '<button class="qx__tab" data-m="ent">intrication</button>'
|
||||
+ '<button class="qx__tab" data-m="circ">circuit → QPU</button></div>'
|
||||
+ '<div class="qx__stage"><canvas></canvas></div>'
|
||||
+ '<div class="qx__bar" data-bar></div></div>';
|
||||
var root = container.querySelector('.qx'), cv = root.querySelector('canvas'), g = cv.getContext('2d'), bar = root.querySelector('[data-bar]');
|
||||
var mode = 'sup', raf = 0, t = 0, W = 0, H = 0, dpr = Math.min(2, window.devicePixelRatio || 1);
|
||||
LIVE = { mode: function () { return mode; } };
|
||||
function fit() { var r = cv.getBoundingClientRect(); W = r.width; H = r.height; cv.width = W * dpr; cv.height = H * dpr; g.setTransform(dpr, 0, 0, dpr, 0, 0); }
|
||||
var ro; try { ro = new ResizeObserver(fit); ro.observe(cv); } catch (e) {}
|
||||
function emit(ev, o) { try { window.jOSPorts && jOSPorts.emit('quantique', ev, o || {}); } catch (e) {} }
|
||||
function esc(s){var d=document.createElement('div');d.textContent=s;return d.innerHTML;}
|
||||
|
||||
// ---- état par mode ----
|
||||
var S = {
|
||||
sup: { phase: 0, spread: 0.5, collapsed: null, ct: 0 },
|
||||
slit: { observe: false, hits: [], fired: 0 },
|
||||
ent: { measured: null, a: null, b: null, angle: 0 }
|
||||
};
|
||||
|
||||
function bars() {
|
||||
if (mode === 'sup') bar.innerHTML =
|
||||
'<button class="qx__btn" data-act="measure">🎯 mesurer</button>'
|
||||
+ '<span class="qx__lab">phase</span><input type="range" min="0" max="628" value="' + (S.sup.phase * 100 | 0) + '" data-r="phase">'
|
||||
+ '<span class="qx__lab">étalement</span><input type="range" min="15" max="90" value="' + (S.sup.spread * 100 | 0) + '" data-r="spread">'
|
||||
+ '<span class="qx__msg" data-msg>le qubit est dans TOUS ses états — le nuage = |ψ|². Mesure-le : il s\'effondre en UN point.</span>';
|
||||
else if (mode === 'slit') bar.innerHTML =
|
||||
'<button class="qx__btn" data-act="fire">✦ tirer 200</button>'
|
||||
+ '<button class="qx__btn sec ' + (S.slit.observe ? 'on' : '') + '" data-act="observe">👁 observer les fentes</button>'
|
||||
+ '<button class="qx__btn sec" data-act="reset">↺</button>'
|
||||
+ '<span class="qx__msg" data-msg>' + (S.slit.observe ? 'observé : chaque photon choisit UNE fente → 2 bandes, l\'interférence MEURT.' : 'non observé : chaque photon passe par les DEUX → franges d\'interférence.') + '</span>';
|
||||
else if (mode === 'ent') bar.innerHTML =
|
||||
'<button class="qx__btn" data-act="mA">🎯 mesurer A</button>'
|
||||
+ '<button class="qx__btn" data-act="mB">🎯 mesurer B</button>'
|
||||
+ '<button class="qx__btn sec" data-act="reset">↺ ré-intriquer</button>'
|
||||
+ '<span class="qx__msg" data-msg>A et B sont UN seul système. Mesure l\'un : l\'autre se fixe à l\'instant, corrélé — même à l\'autre bout de l\'univers.</span>';
|
||||
else bar.innerHTML =
|
||||
'<span class="qx__lab">portes sur 3 qubits</span>'
|
||||
+ ['h0', 'h1', 'x0', 'x1', 'cx01', 'cx12', 'z2'].map(function (g) { return '<button class="qx__btn sec" data-g="' + g + '">' + g + '</button>'; }).join('')
|
||||
+ '<button class="qx__btn sec" data-act="cclear">↺</button>'
|
||||
+ '<button class="qx__btn" data-act="qasm">⬇ OpenQASM (vrai QPU)</button>'
|
||||
+ '<span class="qx__msg" data-msg>compose un circuit → il tourne sur le simulateur statevector (jOSQuantum) → exporte en OpenQASM, prêt pour un vrai ordinateur quantique.</span>';
|
||||
}
|
||||
var circ = { ops: [], counts: null };
|
||||
function runCirc() { if (!window.jOSQuantum) { S.circ = 'jOSQuantum absent'; return; }
|
||||
var ops = circ.ops; var res = jOSQuantum.run(function () { var r = jOSQuantum.Register(3);
|
||||
ops.forEach(function (o) { if (o === 'h0') r.h(0); else if (o === 'h1') r.h(1); else if (o === 'x0') r.x(0); else if (o === 'x1') r.x(1); else if (o === 'cx01') r.cx(0, 1); else if (o === 'cx12') r.cx(1, 2); else if (o === 'z2') r.z(2); }); return r; }, 512);
|
||||
circ.counts = res.counts;
|
||||
}
|
||||
function setMsg(m) { var e = bar.querySelector('[data-msg]'); if (e) e.textContent = m; }
|
||||
|
||||
// ---- rendu ----
|
||||
function draw() {
|
||||
g.clearRect(0, 0, W, H); g.fillStyle = '#05060e'; g.fillRect(0, 0, W, H);
|
||||
if (mode === 'sup') drawSup(); else if (mode === 'slit') drawSlit(); else if (mode === 'ent') drawEnt(); else drawCirc();
|
||||
}
|
||||
function drawCirc() {
|
||||
var pad = 30, y0 = 40, dy = (H - 90) / 3;
|
||||
g.fillStyle = '#7f8fd0'; g.font = '12px ui-sans-serif'; g.textAlign = 'left';
|
||||
for (var q = 0; q < 3; q++) { var y = y0 + q * dy; g.strokeStyle = '#22345c'; g.beginPath(); g.moveTo(pad, y); g.lineTo(W - pad, y); g.stroke(); g.fillText('q' + q, 6, y + 4); }
|
||||
circ.ops.forEach(function (o, i) { var x = pad + 40 + i * 44; var two = o.indexOf('cx') === 0;
|
||||
if (two) { var c = +o[2], tg = +o[3]; g.strokeStyle = '#b06aff'; g.beginPath(); g.moveTo(x, y0 + c * dy); g.lineTo(x, y0 + tg * dy); g.stroke();
|
||||
g.fillStyle = '#b06aff'; g.beginPath(); g.arc(x, y0 + c * dy, 5, 0, TAU); g.fill(); g.strokeStyle = '#b06aff'; g.beginPath(); g.arc(x, y0 + tg * dy, 10, 0, TAU); g.stroke(); }
|
||||
else { var qq = +o[o.length - 1], gate = o[0].toUpperCase(); g.fillStyle = '#1a2340'; g.fillRect(x - 13, y0 + qq * dy - 13, 26, 26); g.strokeStyle = '#6a8dff'; g.strokeRect(x - 13, y0 + qq * dy - 13, 26, 26); g.fillStyle = '#8fb6ff'; g.textAlign = 'center'; g.fillText(gate, x, y0 + qq * dy + 4); g.textAlign = 'left'; } });
|
||||
// histogramme des mesures
|
||||
if (circ.counts) { var keys = Object.keys(circ.counts).sort(), bw = Math.min(46, (W - 60) / keys.length), mx = 1;
|
||||
keys.forEach(function (k) { if (circ.counts[k] > mx) mx = circ.counts[k]; });
|
||||
var bx = 40, by = H - 16;
|
||||
keys.forEach(function (k, i) { var h = circ.counts[k] / mx * (dy * 1.2); var x = bx + i * (bw + 6);
|
||||
g.fillStyle = 'rgba(150,130,255,.7)'; g.fillRect(x, by - h, bw, h);
|
||||
g.fillStyle = '#9fb0e0'; g.font = '10px ui-monospace'; g.textAlign = 'center'; g.fillText('|' + k + '⟩', x + bw / 2, by + 11); g.textAlign = 'left'; });
|
||||
g.fillStyle = '#6a7bb0'; g.fillText('512 mesures · statevector', 40, H - 2 - dy * 1.3);
|
||||
}
|
||||
}
|
||||
function drawSup() {
|
||||
var cx = W / 2, cy = H / 2, R = Math.min(W, H) * 0.36, s = S.sup;
|
||||
// nuage de probabilité |ψ|² = deux lobes qui battent selon la phase
|
||||
var N = 120;
|
||||
for (var i = 0; i < N; i++) {
|
||||
var a = i / N * TAU;
|
||||
var amp = Math.abs(Math.cos(a - s.phase) ) ; // densité angulaire
|
||||
var puff = 0.5 + 0.5 * Math.cos(2 * (a - s.phase));
|
||||
var rr = R * (0.5 + s.spread * 0.6 * puff);
|
||||
var x = cx + Math.cos(a) * rr, y = cy + Math.sin(a) * rr;
|
||||
var op = 0.10 + 0.5 * amp;
|
||||
var rad = 3 + 10 * amp * (reduce ? 1 : (0.7 + 0.3 * Math.sin(t * 2 + a * 3)));
|
||||
var gr = g.createRadialGradient(x, y, 0, x, y, rad);
|
||||
gr.addColorStop(0, 'rgba(150,130,255,' + op.toFixed(2) + ')'); gr.addColorStop(1, 'rgba(90,140,255,0)');
|
||||
g.fillStyle = gr; g.beginPath(); g.arc(x, y, rad, 0, TAU); g.fill();
|
||||
}
|
||||
g.strokeStyle = 'rgba(120,150,255,.18)'; g.beginPath(); g.arc(cx, cy, R, 0, TAU); g.stroke();
|
||||
g.fillStyle = '#6a7bb0'; g.font = '11px ui-sans-serif'; g.textAlign = 'center';
|
||||
g.fillText('|0⟩', cx + R + 16, cy + 4); g.fillText('|1⟩', cx - R - 16, cy + 4);
|
||||
if (s.collapsed != null) {
|
||||
var ca = s.collapsed, cxp = cx + Math.cos(ca) * R, cyp = cy + Math.sin(ca) * R;
|
||||
var pop = Math.min(1, (t - s.ct) * 4);
|
||||
g.fillStyle = '#ffd86a'; g.beginPath(); g.arc(cxp, cyp, 7 + (1 - pop) * 40, 0, TAU); g.globalAlpha = pop; g.fill(); g.globalAlpha = 1;
|
||||
g.strokeStyle = 'rgba(255,216,106,.5)'; g.beginPath(); g.arc(cxp, cyp, 14, 0, TAU); g.stroke();
|
||||
}
|
||||
}
|
||||
function drawSlit() {
|
||||
var wallX = W * 0.34, screenX = W * 0.9, cy = H / 2, gap = H * 0.09, s = S.slit;
|
||||
// écran d'accumulation (histogramme des impacts)
|
||||
var bins = 90, hist = new Array(bins).fill(0), mx = 1;
|
||||
s.hits.forEach(function (y) { var b = Math.max(0, Math.min(bins - 1, Math.floor((y / H) * bins))); hist[b]++; if (hist[b] > mx) mx = hist[b]; });
|
||||
for (var b = 0; b < bins; b++) { var y = b / bins * H, h = hist[b] / mx * (W * 0.08);
|
||||
g.fillStyle = 'rgba(150,130,255,' + (0.25 + 0.6 * hist[b] / mx) + ')'; g.fillRect(screenX, y, h, H / bins + 1); }
|
||||
g.strokeStyle = '#22345c'; g.beginPath(); g.moveTo(screenX, 0); g.lineTo(screenX, H); g.stroke();
|
||||
// mur + 2 fentes
|
||||
g.fillStyle = '#1a2340'; g.fillRect(wallX - 4, 0, 8, cy - gap - 6); g.fillRect(wallX - 4, cy - gap + 6, 8, 2 * gap - 12); g.fillRect(wallX - 4, cy + gap + 6, 8, H - (cy + gap + 6));
|
||||
// source
|
||||
g.fillStyle = '#8fb6ff'; g.beginPath(); g.arc(W * 0.06, cy, 5, 0, TAU); g.fill();
|
||||
g.fillStyle = s.observe ? '#ff8a5c' : '#7f8fd0'; g.font = '11px ui-sans-serif'; g.textAlign = 'left';
|
||||
g.fillText((s.observe ? '👁 fentes observées' : 'non observé') + ' · ' + s.fired + ' photons', 12, 18);
|
||||
}
|
||||
function drawEnt() {
|
||||
var s = S.ent, y = H / 2, ax = W * 0.28, bx = W * 0.72;
|
||||
// lien
|
||||
g.strokeStyle = s.measured ? 'rgba(120,140,200,.25)' : 'rgba(160,120,255,' + (0.3 + 0.2 * Math.sin(t * 3)) + ')';
|
||||
g.lineWidth = 2; g.beginPath(); g.moveTo(ax, y); g.lineTo(bx, y); g.stroke(); g.lineWidth = 1;
|
||||
function qubit(x, val, lab) {
|
||||
var R = Math.min(W, H) * 0.16;
|
||||
g.strokeStyle = 'rgba(120,150,255,.3)'; g.beginPath(); g.arc(x, y, R, 0, TAU); g.stroke();
|
||||
if (val == null) { for (var i = 0; i < 40; i++) { var a = i / 40 * TAU + (reduce ? 0 : t); var rr = R * (0.4 + 0.5 * Math.abs(Math.cos(a * 2)));
|
||||
g.fillStyle = 'rgba(150,130,255,.5)'; g.beginPath(); g.arc(x + Math.cos(a) * rr, y + Math.sin(a) * rr, 2.5, 0, TAU); g.fill(); } }
|
||||
else { var up = val === 1; g.fillStyle = up ? '#6affc0' : '#ff8a6a'; g.beginPath(); g.arc(x, y - (up ? R * 0.5 : -R * 0.5), 12, 0, TAU); g.fill();
|
||||
g.fillStyle = '#dfe7ff'; g.font = 'bold 15px ui-sans-serif'; g.textAlign = 'center'; g.fillText(up ? '↑ |1⟩' : '↓ |0⟩', x, y + R + 22); }
|
||||
g.fillStyle = '#8fb6ff'; g.font = 'bold 13px ui-sans-serif'; g.textAlign = 'center'; g.fillText(lab, x, y - R - 12);
|
||||
}
|
||||
qubit(ax, s.a, 'A'); qubit(bx, s.b, 'B');
|
||||
}
|
||||
|
||||
// ---- boucle ----
|
||||
function loop() { raf = requestAnimationFrame(loop); t += 1 / 60;
|
||||
if (mode === 'slit' && S.slit.fired < S.slit._target) fireStep();
|
||||
draw();
|
||||
}
|
||||
|
||||
// ---- actions ----
|
||||
function measureSup() { var s = S.sup;
|
||||
// proba : 2 lobes centrés sur phase et phase+π ; on tire selon |ψ|²
|
||||
var p0 = Math.pow(Math.cos(s.phase / 2), 2); // proba lobe |0⟩ (angle 0)
|
||||
var pick = Math.random() < 0.5 + (p0 - 0.5) * 0.9; // biaisé par la phase
|
||||
s.collapsed = pick ? 0 : Math.PI; s.ct = t;
|
||||
setMsg('effondré en ' + (pick ? '|0⟩' : '|1⟩') + ' — le nuage est devenu UN point. L\'observation a créé le réel.');
|
||||
emit('collapse', { state: pick ? 0 : 1 });
|
||||
}
|
||||
S.slit._target = 0;
|
||||
function fireStep() { var s = S.slit, cy = H / 2, batch = 6;
|
||||
for (var k = 0; k < batch && s.fired < s._target; k++) {
|
||||
var y;
|
||||
if (s.observe) { // effet observateur : 2 gaussiennes (2 bandes)
|
||||
var slit = Math.random() < 0.5 ? -1 : 1; y = cy + slit * H * 0.09 + gauss() * H * 0.05;
|
||||
} else { // interférence : densité ∝ cos²(k·y) sous enveloppe
|
||||
var tries = 0, ok = false;
|
||||
do { y = Math.random() * H; var d = (y - cy) / H; var prob = Math.pow(Math.cos(d * 26), 2) * Math.exp(-d * d * 9); ok = Math.random() < prob; tries++; } while (!ok && tries < 20);
|
||||
}
|
||||
s.hits.push(y); if (s.hits.length > 4000) s.hits.shift(); s.fired++;
|
||||
}
|
||||
}
|
||||
function gauss() { return (Math.random() + Math.random() + Math.random() - 1.5) / 1.5; }
|
||||
function measureEnt(which) { var s = S.ent; if (s.measured) return;
|
||||
var v = Math.random() < 0.5 ? 0 : 1; s.a = v; s.b = 1 - v; s.measured = which; // anti-corrélés (singlet)
|
||||
setMsg('tu as mesuré ' + which + ' = ' + (v ? '|1⟩' : '|0⟩') + ' → l\'autre s\'est fixé à ' + (v ? '|0⟩' : '|1⟩') + ' AU MÊME INSTANT. Rien n\'a voyagé.');
|
||||
emit('entangle-measure', { which: which, a: s.a, b: s.b });
|
||||
}
|
||||
|
||||
bar.addEventListener('click', function (e) {
|
||||
var b = e.target.closest('[data-act]'); if (!b) return; var a = b.getAttribute('data-act');
|
||||
if (a === 'measure') measureSup();
|
||||
else if (a === 'fire') { S.slit._target = Math.min(4000, S.slit.fired + 200); }
|
||||
else if (a === 'observe') { S.slit.observe = !S.slit.observe; S.slit.hits = []; S.slit.fired = 0; S.slit._target = 0; bars(); }
|
||||
else if (a === 'reset') { if (mode === 'slit') { S.slit.hits = []; S.slit.fired = 0; S.slit._target = 0; } else { S.ent = { measured: null, a: null, b: null, angle: 0 }; setMsg('ré-intriqués : de nouveau UN seul système en superposition.'); } }
|
||||
else if (a === 'mA') measureEnt('A'); else if (a === 'mB') measureEnt('B');
|
||||
else if (a === 'cclear') { circ.ops = []; circ.counts = null; }
|
||||
else if (a === 'qasm') { if (!window.jOSQuantum) return; var r = jOSQuantum.Register(3);
|
||||
circ.ops.forEach(function (o) { if (o === 'h0') r.h(0); else if (o === 'h1') r.h(1); else if (o === 'x0') r.x(0); else if (o === 'x1') r.x(1); else if (o === 'cx01') r.cx(0, 1); else if (o === 'cx12') r.cx(1, 2); else if (o === 'z2') r.z(2); }); r.measureAll();
|
||||
var qasm = r.qasm(); try { (window.jOSb && jOSb.copy) ? jOSb.copy(qasm) : navigator.clipboard.writeText(qasm); } catch (er) {}
|
||||
setMsg('OpenQASM copié — colle-le sur un vrai QPU (IBM Quantum, etc.). ' + circ.ops.length + ' portes.'); emit('qasm', { ops: circ.ops.length }); }
|
||||
var gg = e.target.closest('[data-g]'); if (gg) { circ.ops.push(gg.getAttribute('data-g')); if (circ.ops.length > 12) circ.ops.shift(); runCirc(); }
|
||||
});
|
||||
bar.addEventListener('input', function (e) { var r = e.target.closest('[data-r]'); if (!r) return; var k = r.getAttribute('data-r');
|
||||
if (k === 'phase') { S.sup.phase = +r.value / 100; S.sup.collapsed = null; } if (k === 'spread') S.sup.spread = +r.value / 100; });
|
||||
root.querySelector('.qx__h').addEventListener('click', function (e) { var tb = e.target.closest('[data-m]'); if (!tb) return;
|
||||
mode = tb.getAttribute('data-m'); root.querySelectorAll('.qx__tab').forEach(function (n) { n.classList.toggle('on', n === tb); }); bars(); emit('mode', { mode: mode }); });
|
||||
|
||||
bars(); fit(); loop();
|
||||
return { unmount: function () { LIVE = null; cancelAnimationFrame(raf); try { ro && ro.disconnect(); } catch (e) {} container.innerHTML = ''; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['quantique'] = { manifest: { id: 'quantique', name: 'Quantique', icon: '🌀' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user