Skip to content

Commit

Permalink
Canonical form circuit builder (#180)
Browse files Browse the repository at this point in the history
* User can specify ancilla, measure, CX|CZ qubits in a plaquette
* Print out ASCII form to console when done

Demo:
https://drive.google.com/file/d/1yChGhv0ErEw5g9OsJp4cRlKj_izdvWBQ/view?usp=sharing
  • Loading branch information
smburdick authored Mar 6, 2024
1 parent f6bf7bd commit 20567c9
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 53 deletions.
8 changes: 1 addition & 7 deletions frontend/src/workspace/components/download/DownloadButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Template from '../../plaquettes/Template';
import config from './config';
import notification from '../notification';

const assert = require('assert');

export default class DownloadButton extends Button {
constructor(
workspace,
Expand Down Expand Up @@ -44,16 +42,12 @@ export default class DownloadButton extends Button {
.toSorted((a, b) => a.globalX - b.globalX) // leftmost qubits
.toSorted((a, b) => a.globalY - b.globalY)[0]; // topmost qubit
plaquette.qubits.forEach((qubit) => {
assert(
qubit.qubitType === 'data' || qubit.qubitType === 'syndrome',
"Qubit type must be either 'data' or 'syndrome'",
);
marshalledPlaquette.qubits.push({
x:
(originQubit.globalX - qubit.globalX) / this.workspace.gridSize,
y:
(originQubit.globalY - qubit.globalY) / this.workspace.gridSize,
qubitType: qubit.qubitType,
qubitType: qubit.label,
});
});
payload.plaquettes.push(marshalledPlaquette);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/workspace/graphics/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default class Grid extends Graphics {
contains = (qubits) => {
const minX = Math.min(...this.visibleUnits().map((unit) => unit.x));
const minY = Math.min(...this.visibleUnits().map((unit) => unit.y));
console.log('Min x, min y', minX, minY);
const unitXs = new Set(this.visibleUnits().map((unit) => [unit.x, unit.x + this.gridSize]).flat());
const unitYs = new Set(this.visibleUnits().map((unit) => [unit.y, unit.y + this.gridSize]).flat());
for (const qubit of qubits) {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/workspace/graphics/GridUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default class GridUnit extends Graphics {
}
// Check whether the click was within the bounds of the grid unit
if (relativeX === this.x && relativeY === this.y) {
console.log('Toggling visibility of ', this.name);
this.visible = !this.visible;
}
};
Expand Down
1 change: 0 additions & 1 deletion frontend/src/workspace/plaquettes/Circuit.js

This file was deleted.

Loading

0 comments on commit 20567c9

Please sign in to comment.