package qiskit

  1. Overview
  2. Docs
Qiskit for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.1.0.zip
md5=6b76c7cae259eba2df5385e686c94f68
sha512=a6dbd9045d86986d0230c4d1e77971142595ed80e8487bd290c3b771b695d544a463b311d252b7ac198081d6d8199d90d3c5126ae639f8ae645b97cc942f8f76

Description

An OCaml wrapper for the Qiskit quantum computing toolkit

Published: 29 Jul 2020

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 prov = IBMQ.enable_account "IBMQ_API_KEY" in
let j = Provider.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

License

Copyright (c) 2020 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 >= "20200518"
  2. dune >= "2.5.0"
  3. ocaml >= "4.05.0"

Dev Dependencies

None

Used by

None

Conflicts

None