Conversation
Quantum js vis branch
Update gate to not create default amazonBraketSymbols for gates.
Update bundle.js, no longer creates default AmazonBraketSymbols for Qjs
Reduce width of palette on creation in a JupyterNotebook via braket()…
AjinkyaGawali
left a comment
There was a problem hiding this comment.
Overall sprinkle comments here and there to explain complicate code chunks usually around the regex part, also try using explicit variable names wherever you can(eg: re is used for regex pattern multiple times).
Overall great work!
|
|
||
| position: relative; | ||
| width: 50%; | ||
| width: 100%; |
There was a problem hiding this comment.
width: 100% for Q-circuit-palette was the original CSS in Q.js. 50% creates too small a Q-circuit-palette for the browser.
| /* | ||
|
|
||
| Copyright © 2019–2020, Stewart Smith. See LICENSE for details. | ||
| Copyright © 2019–2020, Stewart Smith. See LICENSE for details. |
| in to “essential global Q.js styles” which will | ||
| remain here in Q.css, and “documentation-specific” | ||
| in to “essential global Q.js styles†which will | ||
| remain here in Q.css, and “documentation-specific†|
| max-width: 100%; | ||
| overflow-x: auto; | ||
| font-family: var( --Q-font-family-sans ); | ||
| /*letter-spacing: 0.03em;*/ |
There was a problem hiding this comment.
we can remove code that we are not using, we you are still experimenting and will need to uncomment this in future
| margin: 1em 0.5em; | ||
| padding: 1em; | ||
| font-family: var( --Q-font-family-mono ); | ||
| /*font-family: var( --Q-font-family-mono );*/ |
| test("Testing evaluateInput() with input 'help' and an empty circuit.", () => { | ||
| let expectedText = runner.printMenu(); | ||
| runner.evaluateInput("help", circuit); | ||
| expect(console.log).toHaveBeenCalled(); |
There was a problem hiding this comment.
redundant test, the next line takes care of this assert already
| //create empty circuit. | ||
| test("Check that evaluateOperation is called once for input 'h(1, [1])'", () => { | ||
| let circuit = quantumjs.Q(); | ||
| runner.evaluateInput("h(1, [1])", circuit); |
There was a problem hiding this comment.
check if H was not present before
| runner.evaluateInput("h( 1 , [ 1 ], 3)", circuit) | ||
| expect(circuit.get(1, 1)).toBeUndefined(); | ||
| }) | ||
| test("Check that evaluateOperation is called for input 'x(1, [1, 2])'", () => { |
There was a problem hiding this comment.
Using mocks you can assert whether a function is called or not https://jestjs.io/docs/mock-functions Your test description talks about it is checking whether a fucntion is called or not, but it is not really checking that, use mocks to test that
There was a problem hiding this comment.
Ah, I wasn't sure how to test user prompts! Thank you, I'll look into mocking prompt()!
| Object.entries(quantumjs.Gate.constants).forEach(function(entry) { | ||
| let gate = entry[1]; | ||
| let input = gate.nameCss + (gate.is_multi_qubit ? "(1, [1, 2])" : "(1, [1])"); | ||
| console.log(input); |
There was a problem hiding this comment.
I think this log is for dev purposes, so can be removed
There was a problem hiding this comment.
Good call! Removed!
| let circuit = quantumjs.Q(); | ||
| //Set a hadamard operation on the circuit. | ||
| circuit.set$('H', 1, [1]); | ||
| runner.evaluateInput('remove( 1 , [ 1 ] )', circuit); |
… as references to set$ method
…eneration in evaluateInput() method
…e bundle.css to match
Reduce width of palette on creation in a JupyterNotebook via braket()…
Quantum js vis branch
Quantum js cli
…arameters object as an argument
Quantum js cli, add support for variable prompt. Add some testing for prepareCircuit().
remove extraneous console.log
…ltanali.github.io into quantum-js-vis-branch
The following PR includes the quantum-js-vis package which contains a modularized Q-Circuit-Editor and Q-Bloch-Sphere. As well, it edits the <script> and references in all the HTML files that create the quantumjavascript.app site to reference build/bundle.js, a bundle of all the Qjs Node modules needed to run the website.
Lastly, this PR includes a module/CSS bundling script for the website and to establish a bundle that can be used in a Jupyter Notebook to call the braket() method to inject an editor into the Notebook.