GithubHelp home page GithubHelp logo

kyamaz / quantex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openql-org/quantex

0.0 2.0 1.0 50 KB

Quantum computer system environment and libraries in Elixir

License: Apache License 2.0

Elixir 100.00%

quantex's Introduction

Quantex

Quantex is a quantum computer system environment and libraries in Elixir. Here is an example:

iex> Q.q0  # |0> qubit = ( 1, 0 )
%Array{array: [1, 0], shape: {2, nil}}

iex> Q.q1  # |1> qubit = ( 0, 1 )
%Array{array: [0, 1], shape: {2, nil}}

iex> Q.q0 |> Q.x  # X|0> = |1> = ( 1, 0 ) ... X Gate (Bit inversion gate)
%Array{array: [0, 1], shape: {2, nil}}

iex> Q.q1 |> Q.x  # X|1> = |0> = ( 0, 1 )
%Array{array: [1, 0], shape: {2, nil}}

iex> Q.q0 |> Q.z  # Z|0> = |0> = ( 1, 0 )... Z Gate (Phase inversion gate)
%Array{array: [1, 0], shape: {2, nil}}

iex> Q.q1 |> Q.z  # Z|1> = -|1> = ( 0, -1 )
%Array{array: [0, -1], shape: {2, nil}}

iex> Q.q0 |> Q.h  # H|0> = 1 / sqrt( 2 ) |0> + 1 / sqrt( 2 ) |1> = ( 0.7, 0.7 ) ... H Gate (Hadamard gate)
%Array{array: [0.7071067811865475, 0.7071067811865475], shape: {2, nil}}

iex> Q.q1 |> Q.h  # H|1> = 1 / sqrt( 2 ) |0> - 1 / sqrt( 2 ) |1> = ( 0.7, -0.7 )
%Array{array: [0.7071067811865475, -0.7071067811865475], shape: {2, nil}}

iex> Q.cnot( Q.q0, Q.q0 )  # CNOT|00> = |00> = ( 1, 0, 0, 0 ) ... CNOT gate(Controlled NOT gate)
%Array{array: [1, 0, 0, 0], shape: {4, nil}}

iex> Q.cnot( Q.q0, Q.q1 )  # CNOT|01> = |01> = ( 0, 1, 0, 0 )
%Array{array: [0, 1, 0, 0], shape: {4, nil}}

iex> Q.cnot( Q.q1, Q.q0 )  # CNOT|10> = |11> = ( 0, 0, 0, 1 )
%Array{array: [0, 0, 0, 1], shape: {4, nil}}

iex> Q.cnot( Q.q1, Q.q1 )  # CNOT|11> = |10> = ( 0, 0, 1, 0 )
%Array{array: [0, 0, 1, 0], shape: {4, nil}}

iex> Q.cnot( Q.q1, Q.q0 ) |> Q.z  # Cz(|11>) = -|11> = ( 0, 0, 0, -1 )
%Array{array: [0, 0, 0, -1], shape: {4, nil}}

iex> Q.epr( Q.q0(), Q.q0 )  # EPR|00> = 1 / sqrt( 2 ) |00> + 1 / sqrt( 2 ) |11> = ( 0.7, 0, 0, 0.7 ) ... EPR pair
%Array{array: [0.7071067811865475, 0, 0, 0.7071067811865475], shape: {4, nil}}

See the online documentation.

Installation

Add to your mix.exs file:

def deps do
  [
    { :quantex, "~> 0.0.4" }
  ]
end

License

This project is licensed under the terms of the Apache 2.0 license, see LICENSE.

quantex's People

Contributors

piacerex avatar

Watchers

Kiyohito Yamaz. avatar James Cloos avatar

Forkers

zeam-vm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.