Skip to content

Commit 0a5c9f5

Browse files
committed
Few improvements and added link to Quantum Programming Studio
1 parent 0981d0d commit 0a5c9f5

7 files changed

+337
-62
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ Quantum Circuit Simulator
44
Quantum circuit simulator implemented in javascript. Smoothly runs 20+ qubit simulations in browser or at server (node.js). You can use it in your javascript program to run quantum simulations. Circuit can be imported from and exported to [OpenQASM](https://github.com/Qiskit/openqasm). You can export circuit to [pyQuil](http://docs.rigetti.com/en/latest/index.html) and [Quil](https://arxiv.org/abs/1608.03355) so it can be used for QASM to Quil/pyQuil conversion. Circuit drawing can be exported to [SVG](https://www.w3.org/Graphics/SVG/) vector image.
55

66

7+
### Live examples
8+
9+
10+
<a href="http://www.youtube.com/watch?feature=player_embedded&v=hhPUQtUqYCI" target="_blank"><img src="http://img.youtube.com/vi/hhPUQtUqYCI/0.jpg" alt="Quantum Programming Studio - preview" width="480" height="360" border="10" /></a>
11+
12+
- [Quantum Programming Studio](https://quantum-circuit.com) Web based quantum programming IDE and simulator
13+
14+
- [qasm2pyquil](https://quantum-circuit.com/qasm2pyquil) QASM to pyQuil/Quil online converter
15+
16+
- [example.html](https://quantum-circuit.com/example.html)
17+
18+
719
Using in browser
820
----------------
921

@@ -26,12 +38,6 @@ Simply include [quantum-circuit.min.js](dist/) into your html page (available vi
2638
</html>
2739
```
2840

29-
### Live examples
30-
31-
- [qasm2pyquil](https://quantum-circuit.com/qasm2pyquil) QASM to pyQuil/Quil online converter
32-
33-
- [example.html](https://quantum-circuit.com/example.html)
34-
3541

3642
Using at server with node.js
3743
----------------------------

benchmark/benchmark3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ for(var qubits = 2; qubits <= 25; qubits++) {
6161
circ.addGate("swap", -1, [i, (qubits - i) - 1]);
6262
}
6363
64-
circ.run(null, { partitioning: true });
64+
circ.run(null, { partitioning: false });
6565
6666
var heapUsedMB = process.memoryUsage().heapUsed / 1024 / 1024;
6767

dist/quantum-circuit.js

Lines changed: 259 additions & 47 deletions
Large diffs are not rendered by default.

dist/quantum-circuit.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/quantum-circuit.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/quantum-circuit.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,48 @@ QuantumCircuit.prototype.addMeasure = function(wire, creg, cbit) {
15101510
this.addGate("measure", -1, wire, { creg: { name: creg, bit: cbit } });
15111511
};
15121512

1513+
QuantumCircuit.prototype.removeTrailingColumns = function() {
1514+
var numCols = this.numCols();
1515+
for(var column = numCols - 1; column >= 0; column--) {
1516+
var isEmptyCol = true;
1517+
for(var wire = 0; wire < this.numQubits; wire++) {
1518+
var gate = this.gates[wire][column];
1519+
if(gate) {
1520+
isEmptyCol = false;
1521+
break;
1522+
}
1523+
}
1524+
1525+
if(!isEmptyCol) {
1526+
return;
1527+
}
1528+
1529+
for(var wire = 0; wire < this.numQubits; wire++) {
1530+
this.gates[wire].pop();
1531+
}
1532+
}
1533+
};
1534+
1535+
QuantumCircuit.prototype.removeTrailingRows = function() {
1536+
var numCols = this.numCols();
1537+
for(var wire = this.numQubits - 1; wire >= 0; wire--) {
1538+
var isEmptyRow = true;
1539+
for(var column = 0; column < numCols; column++) {
1540+
var gate = this.gates[wire][column];
1541+
if(gate) {
1542+
isEmptyRow = false;
1543+
break;
1544+
}
1545+
}
1546+
1547+
if(!isEmptyRow) {
1548+
return;
1549+
}
1550+
this.gates.pop();
1551+
this.numQubits--;
1552+
}
1553+
};
1554+
15131555

15141556
QuantumCircuit.prototype.applyTransform = function(U, qubits) {
15151557
var newState = {};
@@ -4014,6 +4056,15 @@ QuantumCircuit.prototype.print = function(onlyPossible) {
40144056
console.log(this.stateAsString(onlyPossible));
40154057
};
40164058

4059+
QuantumCircuit.prototype.cregsAsString = function() {
4060+
var s = "";
4061+
for(var creg in this.cregs) {
4062+
var value = this.getCregValue(creg);
4063+
s += creg + "\t" + value.toString(2) + "\t" + value + "\n";
4064+
}
4065+
return s;
4066+
};
4067+
40174068

40184069
QuantumCircuit.prototype.createCreg = function(creg, len) {
40194070
this.cregs[creg] = [];

utils/README_TEMPLATE.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ Quantum Circuit Simulator
44
Quantum circuit simulator implemented in javascript. Smoothly runs 20+ qubit simulations in browser or at server (node.js). You can use it in your javascript program to run quantum simulations. Circuit can be imported from and exported to [OpenQASM](https://github.com/Qiskit/openqasm). You can export circuit to [pyQuil](http://docs.rigetti.com/en/latest/index.html) and [Quil](https://arxiv.org/abs/1608.03355) so it can be used for QASM to Quil/pyQuil conversion. Circuit drawing can be exported to [SVG](https://www.w3.org/Graphics/SVG/) vector image.
55

66

7+
### Live examples
8+
9+
10+
<a href="http://www.youtube.com/watch?feature=player_embedded&v=hhPUQtUqYCI" target="_blank"><img src="http://img.youtube.com/vi/hhPUQtUqYCI/0.jpg" alt="Quantum Programming Studio - preview" width="480" height="360" border="10" /></a>
11+
12+
- [Quantum Programming Studio](https://quantum-circuit.com) Web based quantum programming IDE and simulator
13+
14+
- [qasm2pyquil](https://quantum-circuit.com/qasm2pyquil) QASM to pyQuil/Quil online converter
15+
16+
- [example.html](https://quantum-circuit.com/example.html)
17+
18+
719
Using in browser
820
----------------
921

@@ -26,12 +38,6 @@ Simply include [quantum-circuit.min.js](dist/) into your html page (available vi
2638
</html>
2739
```
2840

29-
### Live examples
30-
31-
- [qasm2pyquil](https://quantum-circuit.com/qasm2pyquil) QASM to pyQuil/Quil online converter
32-
33-
- [example.html](https://quantum-circuit.com/example.html)
34-
3541

3642
Using at server with node.js
3743
----------------------------

0 commit comments

Comments
 (0)