Skip to content

Commit dfae02d

Browse files
Theo/documentation 2 (#85)
* quantum circuit details section * quantum circuit documentation references * References to Node-RED Quantum webpages * Rearranged node order * Revisited phase gate documentation * Reformulated a sentence * Revisited the definition of a phase shift * Revisited the definition of a phase shift * `controlled-u-gate` documentation * Minor changes to documentation * multi controlled u gate documentation * Improved documentation structure * Formatting the arrow special character * TOFFOLI gate documentation * 'Bits only' as default option, more friendly * Measure node documentation * Accurate reference to the exact Qiskit function we are applying * Hadamard node color more readable * Redundancy in circuit diagram * Circuit Diagram documentation * Bloch Sphere node documentation * Script node documentation * Indicated how to generate classical bits * local simulator documentation * Minor typo fixed * Remove extra indent * IBM quantum sytems documentation * Quantum circuit documentation * Quantum circuit documentation * Quantum circuit documentation * IBM Quantum node documentation update * Quantum circuit documentation update * Quantum Register documentation * Classical register documentation * Grover's documentation not displaying * Updated documentation templates * `npm run lint` * Removed unused variable declarations
1 parent 98e900d commit dfae02d

File tree

35 files changed

+1170
-263
lines changed

35 files changed

+1170
-263
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070
"controlled-u-gate": "quantum/nodes/controlled-u-gate/controlled-u-gate.js",
7171
"multi-controlled-u-gate": "quantum/nodes/multi-controlled-u-gate/multi-controlled-u-gate.js",
7272
"measure": "quantum/nodes/measure/measure.js",
73-
"local-simulator": "quantum/nodes/local-simulator/local-simulator.js",
74-
"ibm-quantum-system": "quantum/nodes/ibm-quantum-system/ibm-quantum-system.js",
73+
"bloch-sphere": "quantum/nodes/bloch-sphere/bloch-sphere.js",
7574
"circuit-diagram": "quantum/nodes/circuit-diagram/circuit-diagram.js",
7675
"script": "quantum/nodes/script/script.js",
77-
"grovers": "quantum/nodes/grovers/grovers.js",
78-
"bloch-sphere": "quantum/nodes/bloch-sphere/bloch-sphere.js"
76+
"local-simulator": "quantum/nodes/local-simulator/local-simulator.js",
77+
"ibm-quantum-system": "quantum/nodes/ibm-quantum-system/ibm-quantum-system.js",
78+
"grovers": "quantum/nodes/grovers/grovers.js"
7979
}
8080
}
8181
}

quantum/nodes/barrier/locales/en-US/barrier.html

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
To do this, open the node properties and select the number of qubits objects
1111
that the barrier node will be expecting, before allowing them to continue running.
1212
<br/><br/>
13-
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.library.Barrier.html">Barrier - Qiskit documentation</a>
13+
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.barrier">Barrier - Qiskit documentation</a>
1414
</p>
1515

1616
<h3>Inputs</h3>
@@ -36,22 +36,25 @@ <h3>Outputs</h3>
3636
</dt>
3737
<dd>"Quantum Circuit"</dd>
3838
</dl>
39-
40-
<h3>Details</h3>
41-
<p>
42-
Qubit objects can be generated from:
43-
<ul>
44-
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
45-
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
46-
</ul>
47-
48-
Unless specified, qubits are initialised in the 0 state.
49-
</p>
5039

40+
<br />
41+
<h3>Details</h3>
42+
<br />
5143
<p>
44+
Qubit objects can be generated from:
45+
<ul>
46+
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
47+
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
48+
</ul>
49+
Unless specified, qubits are initialised in the 0 state.
50+
<br /><br />
5251
<b>
5352
For a brief summary of the main quantum computing concepts, please refer to the
5453
<i>Details</i> section of the <i>Quantum Circuit</i> node.
5554
</b>
55+
<br /><br />
56+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
57+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
58+
<br /><br />
5659
</p>
5760
</script>
Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,72 @@
11
<script type="text/html" data-help-name="bloch-sphere">
22
<p>
3-
<!-- Node documentation goes here. -->
4-
This is the implementation of bloch sphere Node.
3+
This node is used to generate a bloch sphere representation of the state of each qubit.
54
</p>
5+
<p>
6+
To do so, place this node at the end of the quantum circuit and
7+
connect all qubit objects from the circuit.
8+
<br />
9+
If not all qubit objects are connected, the node will assume that
10+
the circuit has not finished running and will wait indefinitely.
11+
<br /><br />
12+
To visualise the generated bloch spheres into the Node-RED editor, we recommend to download the
13+
<a href="https://flows.nodered.org/node/node-red-contrib-image-output">node-red-contrib-image-output</a>
14+
module and connect it to the output of the <i>Bloch Sphere</i> node.
15+
<br /><br />
16+
<b>Careful -</b> <i>Measure</i> nodes are not compatible with the <i>Bloch Sphere</i> node because
17+
the act of measuring a qubit collapses the qubit state.<br/>
18+
Please remove <i>Measure</i> nodes from the circuit before using the <i>Bloch Sphere</i> node.
19+
<br /><br />
20+
For more details on the <b>Bloch Sphere</b> representation of qubit states, please refer to the
21+
<i>Details</i> section of the <i>Quantum Circuit</i> node.
22+
<br /><br />
23+
<a href="https://qiskit.org/textbook/ch-states/representing-qubit-states.html#bloch-sphere-2">Bloch Sphere - Qiskit textbook</a><br />
24+
<a href="https://qiskit.org/documentation/stubs/qiskit.visualization.plot_bloch_multivector.html">Bloch Sphere - Qiskit documentation</a>
25+
<br /><br />
26+
</p>
27+
28+
<h3>Inputs</h3>
29+
<dl class="message-properties">
30+
<dt>payload
31+
<span class="property-type">object</span>
32+
</dt>
33+
<dd>All qubit objects of the quantum circuit.</dd>
34+
<dt class="optional">topic
35+
<span class="property-type">string</span>
36+
</dt>
37+
<dd>"Quantum Circuit"</dd>
38+
</dl>
39+
40+
<h3>Outputs</h3>
41+
<dl class="message-properties">
42+
<dt>payload
43+
<span class="property-type">string</span>
44+
</dt>
45+
<dd>A base64 string representation of the generated bloch sphere image.</dd>
46+
<dt class="optional">topic
47+
<span class="property-type">string</span>
48+
</dt>
49+
<dd>"Quantum Circuit"</dd>
50+
</dl>
51+
52+
<br />
53+
<h3>Details</h3>
54+
<br />
55+
<p>
56+
Qubit objects can be generated from:
57+
<ul>
58+
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
59+
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
60+
</ul>
61+
Unless specified, qubits are initialised in the 0 state.
62+
<br /><br />
63+
<b>
64+
For a brief summary of the main quantum computing concepts, please refer to the
65+
<i>Details</i> section of the <i>Quantum Circuit</i> node.
66+
</b>
67+
<br /><br />
68+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
69+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
70+
<br /><br />
71+
</p>
672
</script>

quantum/nodes/circuit-diagram/circuit-diagram.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ module.exports = function(RED) {
9393
return;
9494
}
9595

96-
// Emptying the runtime variables upon output
97-
node.qubits = [];
98-
node.qreg = '';
99-
10096
let script = snippets.CIRCUIT_DIAGRAM + snippets.ENCODE_IMAGE;
10197
await shell.execute(script, (err, data) => {
10298
if (err) {
Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
11
<script type="text/html" data-help-name="circuit-diagram">
22
<p>
3-
This node is used for generating a circuit diagram.
3+
This node is used to generate a diagram of your quantum circuit.
44
</p>
5+
<p>
6+
To do so, place this node at the end of the quantum circuit and
7+
connect all qubit objects from the circuit.
8+
<br />
9+
If not all qubit objects are connected, the node will assume that
10+
the circuit has not finished running and will wait indefinitely.
11+
<br /><br />
12+
To visualise the generated diagram into the Node-RED editor, we recommend to download the
13+
<a href="https://flows.nodered.org/node/node-red-contrib-image-output">node-red-contrib-image-output</a>
14+
module and connect it to the output of the <i>Circuit Diagram</i> node.
15+
<br /><br />
16+
It is a common feature in Qiskit to generate visual representations of your circuit for
17+
debugging since it is often easier to visualise a quantum circuit rather than reading the equivalent python code.
18+
<br /><br />
19+
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.draw">Circuit Diagram - Qiskit documentation</a>
20+
<br /><br />
21+
</p>
22+
23+
<h3>Inputs</h3>
24+
<dl class="message-properties">
25+
<dt>payload
26+
<span class="property-type">object</span>
27+
</dt>
28+
<dd>All qubit objects of the quantum circuit.</dd>
29+
<dt class="optional">topic
30+
<span class="property-type">string</span>
31+
</dt>
32+
<dd>"Quantum Circuit"</dd>
33+
</dl>
34+
35+
<h3>Outputs</h3>
36+
<dl class="message-properties">
37+
<dt>payload
38+
<span class="property-type">string</span>
39+
</dt>
40+
<dd>A base64 string representation of the circuit diagram.</dd>
41+
<dt class="optional">topic
42+
<span class="property-type">string</span>
43+
</dt>
44+
<dd>"Quantum Circuit"</dd>
45+
</dl>
46+
47+
<br />
48+
<h3>Details</h3>
49+
<br />
50+
<p>
51+
Qubit objects can be generated from:
52+
<ul>
53+
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
54+
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
55+
</ul>
56+
Unless specified, qubits are initialised in the 0 state.
57+
<br /><br />
58+
<b>
59+
For a brief summary of the main quantum computing concepts, please refer to the
60+
<i>Details</i> section of the <i>Quantum Circuit</i> node.
61+
</b>
62+
<br /><br />
63+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
64+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
65+
<br /><br />
66+
</p>
567
</script>
Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,51 @@
11
<script type="text/html" data-help-name="classical-register">
2-
<p>
3-
This node is used for implementing a classical register in the quantum
4-
circuit which groups a number of classical bits under a single label for
5-
circuit structuring purposes. <br /><br />
6-
To use this node, select how many classical bits the given classical
7-
register will be responsible for grouping.
8-
</p>
2+
<p>
3+
This node implements a classical register, storing a given number of classical bits.
4+
</p>
5+
<p>
6+
To use this node, specify the name of the register, the number of bits to be stored and
7+
connect it to an output of the <i>Quantum Circuit</i> node in 'Register' mode.
8+
<br /><br />
9+
This node does not output anything. The classical bit structure of the quantum circuit is simply saved to be used later on.<br />
10+
Classical bits, either in a register or as individual bits, are crucial in a quantum circuit to store the result of qubit measurements.
11+
<br /><br />
12+
Please be aware that the number of <i>Quantum Register</i> and <i>Classical Register</i> nodes must match
13+
the numbers specified in the <i>Quantum Circuit</i> node's properties.
14+
<br /><br />
15+
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.ClassicalRegister.html#qiskit.circuit.ClassicalRegister">Classical Register - Qiskit documentation</a>
16+
<br /><br />
17+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
18+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
19+
<br /><br />
20+
</p>
21+
22+
<h3>Inputs</h3>
23+
<dl class="message-properties">
24+
<dt>payload
25+
<span class="property-type">object</span>
26+
</dt>
27+
<dd>A register object, generated by the <i>Quantum Circuit</i> node.</dd>
28+
<dt class="optional">topic
29+
<span class="property-type">string</span>
30+
</dt>
31+
<dd>"Quantum Circuit"</dd>
32+
</dl>
33+
34+
<br />
35+
<h3>Details</h3>
36+
<br />
37+
Register objects can be generated from the <i>Quantum Circuit</i> node in 'Register' mode.
38+
Register objects are identical for <i>Quantum Register</i> and <i>Classical Register</i> nodes.
39+
However, an error will be raised if the number of each register type does not correspond to the
40+
<i>Quantum Circuit</i> node's properties.
41+
<br /><br />
42+
<b>
43+
For a brief summary of the main quantum computing concepts, please refer to the
44+
<i>Details</i> section of the <i>Quantum Circuit</i> node.
45+
</b>
46+
<br /><br />
47+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
48+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
49+
<br /><br />
50+
</p>
951
</script>

quantum/nodes/cnot-gate/locales/en-US/cnot-gate.html

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
The 'control' qubit state is not affected.
1313
<br /><br />
1414
<a href="https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#cnot">CNOT gate - Qiskit textbook</a><br/>
15-
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html">CNOT gate - Qiskit documentation</a>
15+
<a href="https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.cx">CNOT gate - Qiskit documentation</a>
1616
<br /><br />
1717
Now, let's assume the 'target' qubit is in the '0' state. <br />
1818
If the 'control' qubit is in a <b>superposition</b> state (25% '0' / 75% '1'),
@@ -23,7 +23,8 @@
2323
</ul>
2424
The 2 qubits are now connected by a 'spooky' phenomenon called <b>entanglement</b>.
2525
<br/><br/>
26-
<a href="https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#entangled">Entanglement - Qiskit textbook</a>
26+
<a href="https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#entangled">Entanglement - Qiskit textbook</a>
27+
<br /><br />
2728
</p>
2829

2930
<h3>Inputs</h3>
@@ -50,22 +51,25 @@ <h3>Outputs</h3>
5051
<dd>"Quantum Circuit"</dd>
5152
</dl>
5253

54+
<br />
5355
<h3>Details</h3>
56+
<br />
5457
<p>
55-
Qubit objects can be generated from:
56-
<ul>
57-
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
58-
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
59-
</ul>
60-
61-
Unless specified, qubits are initialised in the 0 state.
62-
</p>
63-
64-
<p>
58+
Qubit objects can be generated from:
59+
<ul>
60+
<li><i>Quantum Circuit</i> node in 'Bits only' mode.</li>
61+
<li><i>Quantum Register</i> node along with <i>Quantum Circuit</i> in 'Register' mode.</li>
62+
</ul>
63+
Unless specified, qubits are initialised in the 0 state.
64+
<br /><br />
6565
<b>
6666
For a brief summary of the main quantum computing concepts, please refer to the
6767
<i>Details</i> section of the <i>Quantum Circuit</i> node.
6868
</b>
69+
<br /><br />
70+
<a href="https://flows.nodered.org/node/node-red-contrib-quantum">Node-RED Quantum documentation - Node-RED website</a><br/>
71+
<a href="https://www.npmjs.com/package/node-red-contrib-quantum">Node-RED Quantum documentation - NPM website</a>
72+
<br /><br />
6973
</p>
7074
</script>
7175

0 commit comments

Comments
 (0)