Qiskit.js
⚛️ Quantum Information Science Kit for JavaScript, I was born as a clone of my big brother.
🎁 Follow us on Twitter
if you like this project
Alpha: Until v1 breaking changes could be included.
Philosophy
📙 The basic concept of our quantum program is an array of quantum circuits. The program workflow consists of three stages: Build, Compile, and Run. Build allows you to make different quantum circuits that represent the problem you are solving. Compile allows you to rewrite them to run on different backends (simulators/real chips of different quantum volumes, sizes, fidelity, etc); and Run launches the jobs. After the jobs have been run, the data is collected. There are methods for putting this data together, depending on the program. This either gives you the answer you wanted or allows you to make a better program for the next instance.
If you want to learn more about Quantum Computing, you're invited to visit our Quamtum Experience project.
Structure
- qiskit: Meta-package, documented in this file. It also includes a command line client, which is your friend if you want to play with all these features without having to use any programming language.
- @qiskit/algo: High level algorithms, thought for developers.
- @qiskit/algo-js: JavaScript engine.
- @qiskit/algo-anu: Australian National University Quantum Random Numbers Server engine.
- @qiskit/algo-ibm: Quantum Experience engine.
- @qiskit/cloud: Library to make easier the interaction with the Quantum Experience.
- @qiskit/utils: Helpers shared among all packages.
- @qiskit/qasm: Some OpenQASM tools, like parser.
- @qiskit/sim: An experimental JS simulator for OpenQASM circuits we're working on.
Qiskit for the browser
Install
npm i -g qiskit
Use
CLI
qiskitjs --help
qiskitjs <command>
Commands:
backend [name] - Get latest calibration stats for a backend [aliases: b]
backends [onlySims] - Get latest calibration stats for a backend [aliases: bs]
calibration [backend] - Get latest calibration stats for a backend [aliases: c]
circuit <circuit> [backend] [shots] [name] [seed] [maxCredits] - Send the circuit to be run in the Quantum
Experience (https://quantumexperience.ng.bluemix.net) [aliases: ci]
credits - Information about your credits [aliases: cr]
factor <number> - Calculate a factor of a number [aliases: f]
job <id> - Get the info of a specific job [aliases: j]
jobs [limit] [offset] - Get all your jobs. Ordered by creation date [aliases: js]
login [printToken] - Use an API key to get a token to make requests [aliases: l]
params [backend] - Get latest parameter stats for a backend [aliases: p]
parse <circuit> - Parse the circuit to our IR (intermediate representation - JSON format) [aliases: p]
queue [backend] - Get the status of a backend queue [aliases: q]
random [engine] [length] [format] [backend] - Generate a true random number among 0 and 1 [aliases: r]
result <jobId> - Get the result of a background job generated by an algorithm method. The engine is ommited
because IBM Q is the unique which uses background jobs for now [aliases: re]
Options:
--help Show help [boolean]
--version Show version number [boolean]
Programatically
const qiskit = require('qiskit');
console.log('True random numbers\n');
qiskit.algo.random().then(rand => console.log(`JavaScript: ${rand}`));
const cloud = new qiskit.Cloud();
cloud.login('YOUR_PERSONAL_TOKEN_HERE').then(() => {
cloud.backends().then(data => {
console.log('(IBM Backends');
console.log(data);
});
qiskit.algo.random({
engine: 'ibm',
custom: cloud,
// default: simulator
// engine: "ibmqx4"
}).then(rand => console.log(`IBM Cloud: ${rand}`))
});
qiskit.algo.random({
engine: 'anu',
length: 8,
}).then(rand => console.log(`ANU Server: ${rand}`));
API
version
The actual version of the library.
version
(string) - Version number.
qasm
A wrapper for the qiskit-qasm
project.
qasm
(object) - The same object provided in the original library.
sim
A wrapper for the qiskit-sim
project.
sim
(object) - The same object provided in the original library.
Cloud
A wrapper for the qiskit-cloud
project.
Cloud
(object) - The same constructor provided in the original library.
utils
A wrapper for the qiskit-utils
project.
utils
(object) - The same object provided in the original library.
algo
A wrapper for the qiskit-algo
project.
algo
(object) - The same object provided in the original library.
Authors
Original code (Python) authors here.
Other Qiskit projects
- Python Qiskit
- ibmqx backend information: Information about the different IBM Q experience backends.
- ibmqx user guide: The users guides for the IBM Q experience.
- OpenQasm: Examples and tools for the OpenQASM intermediate representation.
- Python API: API Client to use IBM Q experience in Python.
- Tutorials: Jupyter notebooks for using Qiskit.
License
🐧 Qiskit is released under the Apache license, v2.0.