README.md

# Quantex

**TODO: Add description**

## Installation

If [available in Hex](https://hex.pm/packages/quantex), the package can be installed
by adding `quantex` to your list of dependencies in `mix.exs`:

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

## Examples

```elixir
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}}
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/quantex](https://hexdocs.pm/quantex).

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