package qiskit

  1. Overview
  2. Docs
Qiskit for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.44.0.zip
md5=00c4df3973902e003c340e47d771df02
sha512=3dc5343bb529912bcccbb6b8b8e5cfaddb414258db35f9c6c56ea1c04174270d39a7dd92dd70da936b088e0b4008dcb36420f0082b77f94c46e19ce8be359015

Description

An OCaml wrapper for the Qiskit quantum computing toolkit

Published: 06 Nov 2023

README

Caml_qiskit

An OCaml wrapper for IBM Qiskit quantum computing toolkit.

Example

open Qiskit

(* Create the circuit *)
let qc = quantum_circuit 2 2 
  |> h 0 
  |> id 1 
  |> barrier
  |> cx 0 1
  |> barrier
  |> measure 0 0
  |> measure 1 1
  |> draw;;

(* Start a simulation *)
Aer.get_backend "qasm_simulator" 
  |> execute qc 
  |> result 
  |> get_counts 
  |> Visualization.plot_histogram;

(* Run the circuit on real quantum hardware *)
let _ = IBMProvider.save_account "TOKEN" in
let j = IBMProvider.get_backend "ibmq_london" prov |> execute qc in
Tools.Monitor.job_monitor j;
j 
  |> result 
  |> get_counts 
  |> Visualization.plot_histogram;;

Install

opam install qiskit

You also need to install these python libraries (via pip):

  • matplotlib

  • numpy

  • qiskit

  • pylatexenc

And optional for IBM quantum cloud computers:

  • qiskit_ibm_provider

License

Copyright (c) 2020-2023 Davide Gessa

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Dependencies (3)

  1. pyml >= "20220905"
  2. dune >= "3.10.0"
  3. ocaml >= "4.05.0"

Dev Dependencies (3)

  1. bisect_ppx dev & >= "2.8.3"
  2. odoc dev & >= "2.2.1"
  3. ounit with-test & >= "2.2.7"

Used by

None

Conflicts

None