Qics is an Idealistic, Quantum Computer Simulation Library.
It works by holding a Quantum Register as a Matrix,
and then multiplying that against various
Gate Matrices.
For more information about the working,
see the src
directory for the source code,
or see examples/node.js
or the Usage Section for information
on the usage of the module.
- A 'Universally Complete', Quantum Circuit Based Simulator
- Gate Expansion Function (To make a single qubit gate work on a register with multiple qubits)
- Relatively Simple To Use
Currently the library is available using Node.js and NPM. To install the module, use the command:
npm install qics
Then you are able to use the module.
When it's installed, Qics exposes two classes,
qics.Register
and qics.gates
.
qics.Register
is the main class, and is the basis of
the simulator.
It is used like any other class using the new
keyword.
Once initiated, there is a number of methods, see below or
the Documentation (To be written).
qics.gates
exposes all of the single qubit gates as 2D arrays.
It also has some static methods, such as generateGate()
.
Again, see the documentation.
Example simulation:
// Import the module
const qics = require('qics');
// Create a new Quantum Register with 3 Qubits
const reg = new qicks.Register(3);
// Apply some gates.
// Hadamard Gate
reg.applyGate('H', 1);
// CNOT Gate, with control as qubit 1, and the
// target as qubit 3
reg.applyGate('CNOT', 1, 3) ;
// Now measure the register. Should return either "000" or "101"
console.log(reg.measure());
TODO: Write this section, and the documentation
First you need to clone the repo from github:
git clone git://github.com/adamisntdead/qics.git
cd qics
Then install the dependencies:
npm install
Then you can run the build script:
npm run build
This will build the module, and output to the dist
folder.
If you want to build for clint side (i.e. in the browser), run
npm run build:all
and then it will output qics.js and qics.min.js to the dist
folder.
To run the test for this module, after cloning and installing, run:
npm run test
And it will run all of the tests.