Qics is an Idealistic, Quantum Computer Simulation Library.
It works by holding a Quantum Register as a Matrix,
and then multiplying that against various
For more information about the working,
src directory for the source code,
examples/node.js or the Usage Section for information
on the usage of the module.
Currently the library is available using Node.js and NPM. To install the module, use the command:
npm install qics
(NOTE: Works with Node.js Versions >= 4)
If you want to use this in the browser, just add the
Then you are able to use the module.
When it's installed, Qics exposes two classes,
qics.Register is the main class, and is the basis of
It is used like any other class using the
Once initiated, there is a number of methods, see below or
qics.gates exposes all of the single qubit gates as 2D arrays.
It also has some static methods, such as
Again, see the documentation.
// Import the moduleconst qics = ;// Create a new Quantum Register with 3 Qubitsconst reg = 3;// Apply some gates.// Hadamard Gatereg;// CNOT Gate, with control as qubit 1, and the// target as qubit 3reg ;// Now measure the register. Should return either "000" or "101"console;
You can also use your own gates, by inputing them as an Array or Math.Matrix object to the applyGate function.
// Manually Add A NOT Gateconst reg = 2;reg;// Now measure the register. Should return either "10"console;
This library is documented using Inline Prose Comments, and then generated using Docco. The documentation is just source code comments, but the source isn't too complex, and the functions are quite clear to use.
To read the docs, Checkout Here!
To deploy the docs to the github pages, run
git subtree push --prefix docs origin gh-pages
To build the docs, run
npm run docs.
First you need to clone the repo from github:
git clone git://github.com/adamisntdead/qics.gitcd qics
Then install the dependencies:
Then you can run the build script:
npm run build
This will build the module, and output to the
If you want to build for client side (i.e. in the browser), run
npm run build:all and then it will output qics.js and qics.min.js to the
To run the test for this module, after cloning and installing, run:
npm run test
And it will run all of the tests.