Kaynağa Gözat

Fix examples, improve robustness.

master
Pete Shadbolt 8 yıl önce
ebeveyn
işleme
6a8b1a9ceb
3 değiştirilmiş dosya ile 13 ekleme ve 6 silme
  1. +10
    -5
      abp/static/scripts/graph.js
  2. +1
    -0
      examples/visualization/lattice_2d.py
  3. +2
    -1
      examples/visualization/lattice_3d.py

+ 10
- 5
abp/static/scripts/graph.js Dosyayı Görüntüle

@@ -50,11 +50,16 @@ graph.update = function(newState) {
if (editor.selection) {
console.log(editor.selection);
var node = editor.selection;
editor.grid.position.copy(abj.node[node].position);
gui.controls.target.copy(abj.node[node].position);
node_name.innerHTML = "Node " + node;
node_data.className = "visible";
node_vop.innerHTML = "VOP: " + abj.node[node].vop;
if (Object.prototype.hasOwnProperty.call(abj.node, node)) {
editor.grid.position.copy(abj.node[node].position);
gui.controls.target.copy(abj.node[node].position);
node_name.innerHTML = "Node " + node;
node_data.className = "visible";
node_vop.innerHTML = "VOP: " + abj.node[node].vop;
} else {
editor.selection = undefined;
node_data.className = "hidden";
}
} else {
node_data.className = "hidden";
}


+ 1
- 0
examples/visualization/lattice_2d.py Dosyayı Görüntüle

@@ -40,4 +40,5 @@ for node in nodes:

for edge in edges:
psi.act_cz(str(edge[0]), str(edge[1]))
psi.update(0.1)


+ 2
- 1
examples/visualization/lattice_3d.py Dosyayı Görüntüle

@@ -45,9 +45,10 @@ nodes, edges = lattice(threedee_unit_cell, (3, 3, 3))

psi = GraphState()
for node in nodes:
psi.add_node(str(node), position=xyz(*node))
psi.add_qubit(str(node), position=xyz(*node))
psi.act_hadamard(str(node))

for edge in edges:
psi.act_cz(str(edge[0]), str(edge[1]))
psi.update()


Yükleniyor…
İptal
Kaydet