Pārlūkot izejas kodu

Fix examples, improve robustness.

master
Pete Shadbolt pirms 8 gadiem
vecāks
revīzija
6a8b1a9ceb
3 mainītis faili ar 13 papildinājumiem un 6 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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()


Notiek ielāde…
Atcelt
Saglabāt