davidbkemp / jsqubits Goto Github PK
View Code? Open in Web Editor NEWQuantum computation simulation JavaScript library
License: MIT License
Quantum computation simulation JavaScript library
License: MIT License
Looks like jsqubits runner has stable architecture, but this repo doesn't.
It says
Failed to load resource: the server responded with a status of 404 (File not found)
.
So I can be sure there must be some directory like dist
, but there isn't(at least in this github repo). Perhaps there are some differences between runner's version and repo.
Basically, I need some help of this library's author...to make some working quantum program.
Hello,
First, thanks a lot for this great simulator, it will be quite practical for me. I just have a minor issue: would it be possible to provide from time to time a packed .js file for simple in-browser use? Because otherwise one need to install nodejs to write the code, or download the .js file used in the demo that may be outdated.
By the way, the README says:
Use it in your own web application by including the JavaScript files available from GitHub: https://github.com/davidbkemp/jsqubits/tree/master/lib (jsqubits.js is the core library, while jsqubitsmath.js ...)
However, neither jsqubits.js
nor jsqubitsmath.js
exist in this folder.
Would you like to ask how to realize the conjugate calculation of quantum gate, or how to get the conjugate quantum gate
Need to document the jsqubitsmaths library.
If the requirejs define method is defined, then use it
If the npm module.exports is defined, then use it
Otherwise put jsqubits in the global namespace.
Hello,
Since I want to use jsqubits with TypeScript, I wrote d.ts of jsqubits.
https://github.com/qramana/jsqubits.d.ts
This type definition mostly covers the I/F of jsqubits.
I'm already happy, but I think it would be more useful if this was published npm.
May I create PR of this for DefinitelyTyped? (DefinitelyTyped is TypeScript d.ts repository)
This d.ts maybe named @types/jsqubits when publish.
This name is same as your library.
If you do not want this publish, please let me know.
QState.each() is likely to be useful to anyone wanting to add new operators and should be documented.
measure() and applyFunction() currently do not allow you to specify bit ranges using arrays.
Somehow eql got left behind in the refactor to implement amplitudes as a function instead of as a simple array.
A very minor improvement in readability and efficiency by using these constants.
Should also consider defining some more constants on jsqubits.Complex.
I believe they are supposed to have a message property.
@davidbkemp
I'm trying to refactor the project to ES6 syntax. If done, will you merge my pull requests?
If anyone is following this and can help me get my head around the implications of the ES6 transpiling with respect to publishing to npm and node modules it would be greatly appreciated.
Currently you can do this as npm is using the pre-ES6 version of the code:
$ npm install jsqubits
$ node
> qubits = require('jsqubits').jsqubits
With the move to ES6, you need to use require('jsqubits').default
instead of require('jsqubits').jsqubits
I am thinking I should maintain backward compatibility by exporting Qubits as both the default
and as jsqubits
. It looks like this could be done by adding a line to lib/index.js
Either way, I might increment the major version in npm and in github to 2.0.0 just in case this has introduced any breaking changes.
typeof and instanceof are broken.
Try to stop using them. Especially typeof as
typeof new String('foo')
is 'object' not 'string'.
Should look at all the points in:
http://tech.pro/tutorial/1669/21-javascript-parts-i-struggle-to-remember-?utm_source=javascriptweekly&utm_medium=email
StateWithAmplitude is a lame name. QStateComponent would be better. The meaning of the index attribute is not clear (do we need it?). The method names are not obvious and they should probably cache (or precompute) their values.
It would be nice if Complex had a function that returned the phase of the complex number (i.e. the angle when expressed in polar co-ordinates).
Hello,
First, thanks for this nice library. I'd like to perform sometimes some measurements that require auxiliary qubits (a.k.a. ancillae), but after the measurement the qubits are not useful anymore. I can add qubits using the tensor
mechanism, but is there a way to remove qubits that have been measured? It could be useful to avoid to have an increasing number of qubits in use, to simplify the states, and also to simplify the code (one solution to avoid the explosion of the number of qubits in simple cases is to keep in mind which qubit is auxiliary and which one is not, but it complicates the code, and if at one point one needs lots of auxiliary for a particular measurement, then the state will stay big for the rest of the computation).
Thanks!
There have been a couple of times where I really wanted an easy way to project onto the qubits that were not measured.
Bower is no longer all that popular. Even the Bower web site recommends using "Yarn and Webpack or Parcel".
So, I think that the bower.json
should be deleted, but what should I replace it with?
All the babel packages seem to have moved to @babel/*
and, according to the documentation, @babel/polyfill
is deprecated.
https://babeljs.io/docs/en/next/babel-polyfill.html
Do I still really need Babel? I am now wishing that I had insisted on sticking with regular JavaScript.
It would be nice to be able create a state like jsqubits("|++>")
Exception looking for: dist/commonjs/index.js
So I downloaded the distribution release which also lacks a dist folder.
I'm assuming there is a command that will produce a runnable example but I'm not so inclined to fix a broken distribution. Cost / benefit and all.
"As a new user of this library I would like the demo examples to work so I don't need to invest time in development to find out if this code actually works as advertised."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.