From 702c029a796f176f97f14bce66df3651e9e058ac Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 8 Sep 2023 15:24:55 +0000 Subject: [PATCH] build based on 3134491 --- previews/PR37/api/algorithms/index.html | 2 +- previews/PR37/api/circuit/index.html | 2 +- previews/PR37/api/gates/index.html | 4 ++-- previews/PR37/ecosystem/index.html | 2 +- previews/PR37/index.html | 2 +- previews/PR37/search/index.html | 2 +- previews/PR37/search_index.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/previews/PR37/api/algorithms/index.html b/previews/PR37/api/algorithms/index.html index 76a39c9..8e28099 100644 --- a/previews/PR37/api/algorithms/index.html +++ b/previews/PR37/api/algorithms/index.html @@ -1,2 +1,2 @@ -Algorithms · Quac
+Algorithms · Quac
diff --git a/previews/PR37/api/circuit/index.html b/previews/PR37/api/circuit/index.html index f845510..ec54874 100644 --- a/previews/PR37/api/circuit/index.html +++ b/previews/PR37/api/circuit/index.html @@ -1,2 +1,2 @@ -Circuit · Quac

Circuit

Quantum circuits can be seen as DAGs (Direct Acyclic Graphs) in which the width of the DAG is constant and equal to the number of qubits. Also the indgree and outdegree of quantum gates must always be equal. But many state-of-art quantum circuit libraries use either (a) lists of moments of gates or (b) graphs for representing them, which do not exploit the sparsity of the circuit or already make decisions about their layout (thus not having a layout-independent representation).

Instead Quac uses multi-priority queues to store gates: there is a queue per qubit lane that stores the gates that act on it, and priorities are the order in which they are applied. If a gate acts on multiple qubits, it will contain a priority per qubit. This data structure allows us to store gates in the most compact way while iterating on gates, reversing the circuit, ... are still efficient. It appears to be the perfect data structure for quantum circuits.

Was this really necessary?

No, the bottleneck of quantum circuits is not on their representation but when reading the source code of other quantum circuit libraries, I wasn't convinced by their solutions: graphs, already laid out lists of lists, a serialized list of gates, ... So I came up with multi-priority queues which seem like the perfect fit and as a consequence, the implementation is simple yet efficient.

Quac.CircuitType

A quantum circuit implementation using multi-priority queues.

  • Queues are gate-buffers in qubit lanes.
  • Multi-priority numbers can be retrieved procedurally from gate-lanes encoded inside the gates of the queues.
source

Methods

Base.adjointMethod
Base.adjoint(circuit)

Retrieve the adjoint circuit which fulfills the following equality.

circuit * circuit' == I(n)

Notes

If all gates are hermitian, then the following equality also holds.

circuit * circuit' == circuit' * circuit == I(n)
source
Base.hcatMethod
hcat(circuits::Circuit...)

Join circuits in the temporal dimension.

source
Base.iterateMethod
Base.iterate(circuit::Circuit[, state])

Retrieves next gate from state by travelling through a topologically sorted path.

Arguments

  • circuit::Circuit
  • state (or head) should be a NTuple{N, Int} where N is the number of lanes. Each element is a pointer to the next gate on each lane.
source
Base.push!Method
push!(circuit, gate...)

Appends a gate to the circuit.

source
Base.vcatMethod
vcat(circuits::Circuit...)

Join circuits in the spatial dimension.

source
Quac.connectivityFunction
connectivity([f,] circuit)

Generate connectivity graph between qubits.

Arguments

  • f: Function to filter gates from circuit.
  • circuit: Circuit.
source
Quac.lanesMethod
lanes(circuit)

Return the number of qubit lanes in a circuit.

source
Quac.momentsFunction
moments(circuit)

Return moments (lists of gates that can execute at the same time) of the circuit.

source
+Circuit · Quac

Circuit

Quantum circuits can be seen as DAGs (Direct Acyclic Graphs) in which the width of the DAG is constant and equal to the number of qubits. Also the indgree and outdegree of quantum gates must always be equal. But many state-of-art quantum circuit libraries use either (a) lists of moments of gates or (b) graphs for representing them, which do not exploit the sparsity of the circuit or already make decisions about their layout (thus not having a layout-independent representation).

Instead Quac uses multi-priority queues to store gates: there is a queue per qubit lane that stores the gates that act on it, and priorities are the order in which they are applied. If a gate acts on multiple qubits, it will contain a priority per qubit. This data structure allows us to store gates in the most compact way while iterating on gates, reversing the circuit, ... are still efficient. It appears to be the perfect data structure for quantum circuits.

Was this really necessary?

No, the bottleneck of quantum circuits is not on their representation but when reading the source code of other quantum circuit libraries, I wasn't convinced by their solutions: graphs, already laid out lists of lists, a serialized list of gates, ... So I came up with multi-priority queues which seem like the perfect fit and as a consequence, the implementation is simple yet efficient.

Quac.CircuitType

A quantum circuit implementation using multi-priority queues.

  • Queues are gate-buffers in qubit lanes.
  • Multi-priority numbers can be retrieved procedurally from gate-lanes encoded inside the gates of the queues.
source

Methods

Base.adjointMethod
Base.adjoint(circuit)

Retrieve the adjoint circuit which fulfills the following equality.

circuit * circuit' == I(n)

Notes

If all gates are hermitian, then the following equality also holds.

circuit * circuit' == circuit' * circuit == I(n)
source
Base.hcatMethod
hcat(circuits::Circuit...)

Join circuits in the temporal dimension.

source
Base.iterateMethod
Base.iterate(circuit::Circuit[, state])

Retrieves next gate from state by travelling through a topologically sorted path.

Arguments

  • circuit::Circuit
  • state (or head) should be a NTuple{N, Int} where N is the number of lanes. Each element is a pointer to the next gate on each lane.
source
Base.push!Method
push!(circuit, gate...)

Appends a gate to the circuit.

source
Base.vcatMethod
vcat(circuits::Circuit...)

Join circuits in the spatial dimension.

source
Quac.connectivityFunction
connectivity([f,] circuit)

Generate connectivity graph between qubits.

Arguments

  • f: Function to filter gates from circuit.
  • circuit: Circuit.
source
Quac.lanesMethod
lanes(circuit)

Return the number of qubit lanes in a circuit.

source
Quac.momentsFunction
moments(circuit)

Return moments (lists of gates that can execute at the same time) of the circuit.

source
diff --git a/previews/PR37/api/gates/index.html b/previews/PR37/api/gates/index.html index d19b46d..da88231 100644 --- a/previews/PR37/api/gates/index.html +++ b/previews/PR37/api/gates/index.html @@ -1,5 +1,5 @@ -Gates · Quac

Gates

In Quac, gates are symbolic, i.e. they do not store their representation. A gate instance just stores the qubit lane in which it acts and its parameters if needed. Thanks to Julia's multiple-dispatch different representations can be queried lazily from type information.

For example, this is a $Z$ that acts on qubit 4.

julia> gate = Z(4)
+Gates · Quac

Gates

In Quac, gates are symbolic, i.e. they do not store their representation. A gate instance just stores the qubit lane in which it acts and its parameters if needed. Thanks to Julia's multiple-dispatch different representations can be queried lazily from type information.

For example, this is a $Z$ that acts on qubit 4.

julia> gate = Z(4)
 Z(4)

Any gate can be represented by a dense matrix.

julia> Matrix(gate)
 2×2 Matrix{ComplexF32}:
  1.0+0.0im   0.0+0.0im
@@ -9,4 +9,4 @@
  0  -1

Furthermore, the $Z$ gate allows a Diagonal representation!

julia> Diagonal{Float32}(gate)
 2×2 Diagonal{Float32, Vector{Float32}}:
  1.0    ⋅
-  ⋅   -1.0
Quac.GateType
Gate{Operator}(lanes...; parameters...)

An Operator located at some lanes and configured with some parameters.

source

Pauli gates

Quac.IType
I(lane)

The $σ_0$ Pauli matrix gate.

Note

Due to name clashes with LinearAlgebra.I, Quac.I is not exported by default.

source

Hadamard gate

Phase gates

Quac.SType
S(lane)

The $S$ gate or $\frac{π}{2}$ rotation around Z-axis.

source
Quac.SdType
Sd(lane)

The $S^\dagger$ gate or $-\frac{π}{2}$ rotation around Z-axis.

source
Quac.TType
T(lane)

The $T$ gate or $\frac{π}{4}$ rotation around Z-axis.

source
Quac.TdType
Td(lane)

The $T^\dagger$ gate or $-\frac{π}{4}$ rotation around Z-axis.

source

Rotation gates

Quac.RxType
Rx(lane, θ)

The $\theta$ rotation around the X-axis gate.

source
Quac.RyType
Ry(lane, θ)

The $\theta$ rotation around the Y-axis gate.

source
Quac.RzType
Rz(lane, θ)

The $\theta$ rotation around the Z-axis gate.

Notes

  • The U1 gate is an alias of Rz.
source
Quac.RxxType
Rxx(lane1, lane2, θ)

The $\theta$ rotation around the XX-axis gate.

source
Quac.RyyType
Ryy(lane1, lane2, θ)

The $\theta$ rotation around the YY-axis gate.

source
Quac.RzzType
Rzz(lane1, lane2, θ)

The $\theta$ rotation around the ZZ-axis gate.

source

General U2, U3 gates

Controlled gates

SWAP gate

A General Unitary SU{N} gate

The SU{N} gate is a general unitary gate that can be used to represent any unitary matrix that acts on log2(N) qubits. A new random SU{N} can be created with rand(SU{N}, lanes...), where N is the dimension of the unitary matrix and lanes are the qubit lanes on which the gate acts.

Experimental interface

This interface is experimental and may change in the future.

Quac.SUType
SU(N)(lane_1, lane_2, ..., lane_log2(N))

A multi-qubit random unitary operator that acts on log2(N) qubits.

source
+ ⋅ -1.0
Quac.GateType
Gate{Operator}(lanes...; parameters...)

An Operator located at some lanes and configured with some parameters.

source

Pauli gates

Quac.IType
I(lane)

The $σ_0$ Pauli matrix gate.

Note

Due to name clashes with LinearAlgebra.I, Quac.I is not exported by default.

source

Hadamard gate

Phase gates

Quac.SType
S(lane)

The $S$ gate or $\frac{π}{2}$ rotation around Z-axis.

source
Quac.SdType
Sd(lane)

The $S^\dagger$ gate or $-\frac{π}{2}$ rotation around Z-axis.

source
Quac.TType
T(lane)

The $T$ gate or $\frac{π}{4}$ rotation around Z-axis.

source
Quac.TdType
Td(lane)

The $T^\dagger$ gate or $-\frac{π}{4}$ rotation around Z-axis.

source

Rotation gates

Quac.RxType
Rx(lane, θ)

The $\theta$ rotation around the X-axis gate.

source
Quac.RyType
Ry(lane, θ)

The $\theta$ rotation around the Y-axis gate.

source
Quac.RzType
Rz(lane, θ)

The $\theta$ rotation around the Z-axis gate.

Notes

  • The U1 gate is an alias of Rz.
source
Quac.RxxType
Rxx(lane1, lane2, θ)

The $\theta$ rotation around the XX-axis gate.

source
Quac.RyyType
Ryy(lane1, lane2, θ)

The $\theta$ rotation around the YY-axis gate.

source
Quac.RzzType
Rzz(lane1, lane2, θ)

The $\theta$ rotation around the ZZ-axis gate.

source

General U2, U3 gates

Controlled gates

SWAP gate

Special Unitary gate

Experimental interface

This interface is experimental and may change in the future.

Quac.SUType
SU(N)(lane_1, lane_2, ..., lane_log2(N))

The SU{N} multi-qubit general unitary gate that can be used to represent any unitary matrix that acts on log2(N) qubits. A new random SU{N} can be created with rand(SU{N}, lanes...), where N is the dimension of the unitary matrix and lanes are the qubit lanes on which the gate acts.

source
diff --git a/previews/PR37/ecosystem/index.html b/previews/PR37/ecosystem/index.html index 0048c59..8ea768d 100644 --- a/previews/PR37/ecosystem/index.html +++ b/previews/PR37/ecosystem/index.html @@ -1,2 +1,2 @@ -Ecosystem · Quac

Ecosystem

Tenet

Tenet is a Tensor Network library focused on expressibility, flexibility and speed. It leverages Julia's multiple dispatch and parametric typing to specialize functions depending on the ansatz (MPS, PEPS, ...) such as contraction path search, tensor contraction, ...

Gato

Gato is a Statevector (aka Schrödinger-like) simulator.

+Ecosystem · Quac

Ecosystem

Tenet

Tenet is a Tensor Network library focused on expressibility, flexibility and speed. It leverages Julia's multiple dispatch and parametric typing to specialize functions depending on the ansatz (MPS, PEPS, ...) such as contraction path search, tensor contraction, ...

Gato

Gato is a Statevector (aka Schrödinger-like) simulator.

diff --git a/previews/PR37/index.html b/previews/PR37/index.html index ca93de5..1edc3aa 100644 --- a/previews/PR37/index.html +++ b/previews/PR37/index.html @@ -1,2 +1,2 @@ -Home · Quac

Quac.jl

Quac stands for Quantum circuits and it's a library for quantum circuit representation in Julia. It serves as the core library of multiple libraries related to quantum computing: simulators, hardware controllers, ...

Quac is not a simulator or a controller, but it provides the tools to build them.

Features

  • Multiple representation of gates Gates are symbolic in Quac, and thanks to Julia's multiple-dispatch, they posess multiple representations like dense arrays, diagonal matrices, ...
  • (New) compact and efficient description of circuits Unlike other libraries, Quac uses multi-priority queues as the underlying data-structure.
  • SVG rendering of quantum circuits

"4-qubit Quantum Fourier Transform"

  • Extensibility Every part of the package is extensible with new types or functionality as you wish.

Contents

+Home · Quac

Quac.jl

Quac stands for Quantum circuits and it's a library for quantum circuit representation in Julia. It serves as the core library of multiple libraries related to quantum computing: simulators, hardware controllers, ...

Quac is not a simulator or a controller, but it provides the tools to build them.

Features

  • Multiple representation of gates Gates are symbolic in Quac, and thanks to Julia's multiple-dispatch, they posess multiple representations like dense arrays, diagonal matrices, ...
  • (New) compact and efficient description of circuits Unlike other libraries, Quac uses multi-priority queues as the underlying data-structure.
  • SVG rendering of quantum circuits

"4-qubit Quantum Fourier Transform"

  • Extensibility Every part of the package is extensible with new types or functionality as you wish.

Contents

diff --git a/previews/PR37/search/index.html b/previews/PR37/search/index.html index 894d59c..d452d62 100644 --- a/previews/PR37/search/index.html +++ b/previews/PR37/search/index.html @@ -1,2 +1,2 @@ -Search · Quac

Loading search...

    +Search · Quac

    Loading search...

      diff --git a/previews/PR37/search_index.js b/previews/PR37/search_index.js index 4a3d01e..e0d9970 100644 --- a/previews/PR37/search_index.js +++ b/previews/PR37/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"api/gates/#Gates","page":"Gates","title":"Gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"DocTestSetup = quote\n using Quac\n using LinearAlgebra\nend","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"In Quac, gates are symbolic, i.e. they do not store their representation. A gate instance just stores the qubit lane in which it acts and its parameters if needed. Thanks to Julia's multiple-dispatch different representations can be queried lazily from type information.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"For example, this is a Z that acts on qubit 4.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> gate = Z(4)\nZ(4)","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Any gate can be represented by a dense matrix.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Matrix(gate)\n2×2 Matrix{ComplexF32}:\n 1.0+0.0im 0.0+0.0im\n 0.0+0.0im -1.0+0.0im","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"You can even specify the eltype!","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Matrix{Int}(gate)\n2×2 Matrix{Int64}:\n 1 0\n 0 -1","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Furthermore, the Z gate allows a Diagonal representation!","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Diagonal{Float32}(gate)\n2×2 Diagonal{Float32, Vector{Float32}}:\n 1.0 ⋅\n ⋅ -1.0","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Operator\nGate","category":"page"},{"location":"api/gates/#Quac.Operator","page":"Gates","title":"Quac.Operator","text":"Operator\n\nParent type of quantum operators.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Gate","page":"Gates","title":"Quac.Gate","text":"Gate{Operator}(lanes...; parameters...)\n\nAn Operator located at some lanes and configured with some parameters.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Pauli-gates","page":"Gates","title":"Pauli gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Quac.I\nX\nY\nZ","category":"page"},{"location":"api/gates/#Quac.I","page":"Gates","title":"Quac.I","text":"I(lane)\n\nThe σ_0 Pauli matrix gate.\n\nNote\n\nDue to name clashes with LinearAlgebra.I, Quac.I is not exported by default.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.X","page":"Gates","title":"Quac.X","text":"X(lane)\n\nThe σ_1 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Y","page":"Gates","title":"Quac.Y","text":"Y(lane)\n\nThe σ_2 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Z","page":"Gates","title":"Quac.Z","text":"Z(lane)\n\nThe σ_3 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Hadamard-gate","page":"Gates","title":"Hadamard gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"H","category":"page"},{"location":"api/gates/#Quac.H","page":"Gates","title":"Quac.H","text":"H(lane)\n\nThe Hadamard gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Phase-gates","page":"Gates","title":"Phase gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"S\nSd\nT\nTd","category":"page"},{"location":"api/gates/#Quac.S","page":"Gates","title":"Quac.S","text":"S(lane)\n\nThe S gate or fracπ2 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Sd","page":"Gates","title":"Quac.Sd","text":"Sd(lane)\n\nThe S^dagger gate or -fracπ2 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.T","page":"Gates","title":"Quac.T","text":"T(lane)\n\nThe T gate or fracπ4 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Td","page":"Gates","title":"Quac.Td","text":"Td(lane)\n\nThe T^dagger gate or -fracπ4 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Rotation-gates","page":"Gates","title":"Rotation gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Rx\nRy\nRz\nRxx\nRyy\nRzz","category":"page"},{"location":"api/gates/#Quac.Rx","page":"Gates","title":"Quac.Rx","text":"Rx(lane, θ)\n\nThe theta rotation around the X-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Ry","page":"Gates","title":"Quac.Ry","text":"Ry(lane, θ)\n\nThe theta rotation around the Y-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rz","page":"Gates","title":"Quac.Rz","text":"Rz(lane, θ)\n\nThe theta rotation around the Z-axis gate.\n\nNotes\n\nThe U1 gate is an alias of Rz.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rxx","page":"Gates","title":"Quac.Rxx","text":"Rxx(lane1, lane2, θ)\n\nThe theta rotation around the XX-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Ryy","page":"Gates","title":"Quac.Ryy","text":"Ryy(lane1, lane2, θ)\n\nThe theta rotation around the YY-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rzz","page":"Gates","title":"Quac.Rzz","text":"Rzz(lane1, lane2, θ)\n\nThe theta rotation around the ZZ-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#General-U2,-U3-gates","page":"Gates","title":"General U2, U3 gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"U2\nU3","category":"page"},{"location":"api/gates/#Quac.U2","page":"Gates","title":"Quac.U2","text":"U2(lane, ϕ, λ)\n\nThe U2 gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.U3","page":"Gates","title":"Quac.U3","text":"U3(lane, θ, ϕ, λ)\n\nThe U3 gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Controlled-gates","page":"Gates","title":"Controlled gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Control","category":"page"},{"location":"api/gates/#Quac.Control","page":"Gates","title":"Quac.Control","text":"Control(lane, op::Gate)\n\nA controlled gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#SWAP-gate","page":"Gates","title":"SWAP gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Swap","category":"page"},{"location":"api/gates/#Quac.Swap","page":"Gates","title":"Quac.Swap","text":"Swap(lane1, lane2)\n\nThe SWAP gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#A-General-Unitary-SU{N}-gate","page":"Gates","title":"A General Unitary SU{N} gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"The SU{N} gate is a general unitary gate that can be used to represent any unitary matrix that acts on log2(N) qubits. A new random SU{N} can be created with rand(SU{N}, lanes...), where N is the dimension of the unitary matrix and lanes are the qubit lanes on which the gate acts.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"tip: Experimental interface\nThis interface is experimental and may change in the future.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Quac.SU{N}","category":"page"},{"location":"api/gates/#Quac.SU","page":"Gates","title":"Quac.SU","text":"SU(N)(lane_1, lane_2, ..., lane_log2(N))\n\nA multi-qubit random unitary operator that acts on log2(N) qubits.\n\n\n\n\n\n","category":"type"},{"location":"ecosystem/#Ecosystem","page":"Ecosystem","title":"Ecosystem","text":"","category":"section"},{"location":"ecosystem/#Tenet","page":"Ecosystem","title":"Tenet","text":"","category":"section"},{"location":"ecosystem/","page":"Ecosystem","title":"Ecosystem","text":"Tenet is a Tensor Network library focused on expressibility, flexibility and speed. It leverages Julia's multiple dispatch and parametric typing to specialize functions depending on the ansatz (MPS, PEPS, ...) such as contraction path search, tensor contraction, ...","category":"page"},{"location":"ecosystem/#Gato","page":"Ecosystem","title":"Gato","text":"","category":"section"},{"location":"ecosystem/","page":"Ecosystem","title":"Ecosystem","text":"Gato is a Statevector (aka Schrödinger-like) simulator.","category":"page"},{"location":"#Quac.jl","page":"Home","title":"Quac.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Quac stands for Quantum circuits and it's a library for quantum circuit representation in Julia. It serves as the core library of multiple libraries related to quantum computing: simulators, hardware controllers, ...","category":"page"},{"location":"","page":"Home","title":"Home","text":"Quac is not a simulator or a controller, but it provides the tools to build them.","category":"page"},{"location":"#Features","page":"Home","title":"Features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Multiple representation of gates Gates are symbolic in Quac, and thanks to Julia's multiple-dispatch, they posess multiple representations like dense arrays, diagonal matrices, ...\n(New) compact and efficient description of circuits Unlike other libraries, Quac uses multi-priority queues as the underlying data-structure.\nSVG rendering of quantum circuits","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: \"4-qubit Quantum Fourier Transform\")","category":"page"},{"location":"","page":"Home","title":"Home","text":"Extensibility Every part of the package is extensible with new types or functionality as you wish.","category":"page"},{"location":"#Contents","page":"Home","title":"Contents","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"api/algorithms/#Algorithms","page":"Algorithms","title":"Algorithms","text":"","category":"section"},{"location":"api/algorithms/","page":"Algorithms","title":"Algorithms","text":"Quac.Algorithms.QFT","category":"page"},{"location":"api/algorithms/#Quac.Algorithms.QFT","page":"Algorithms","title":"Quac.Algorithms.QFT","text":"QFT(n)\n\nGenerate a Quantum Fourier Transform circuit of n qubits.\n\n\n\n\n\n","category":"function"},{"location":"api/circuit/#Circuit","page":"Circuit","title":"Circuit","text":"","category":"section"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Quantum circuits can be seen as DAGs (Direct Acyclic Graphs) in which the width of the DAG is constant and equal to the number of qubits. Also the indgree and outdegree of quantum gates must always be equal. But many state-of-art quantum circuit libraries use either (a) lists of moments of gates or (b) graphs for representing them, which do not exploit the sparsity of the circuit or already make decisions about their layout (thus not having a layout-independent representation).","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Instead Quac uses multi-priority queues to store gates: there is a queue per qubit lane that stores the gates that act on it, and priorities are the order in which they are applied. If a gate acts on multiple qubits, it will contain a priority per qubit. This data structure allows us to store gates in the most compact way while iterating on gates, reversing the circuit, ... are still efficient. It appears to be the perfect data structure for quantum circuits.","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"tip: Was this really necessary?\nNo, the bottleneck of quantum circuits is not on their representation but when reading the source code of other quantum circuit libraries, I wasn't convinced by their solutions: graphs, already laid out lists of lists, a serialized list of gates, ... So I came up with multi-priority queues which seem like the perfect fit and as a consequence, the implementation is simple yet efficient.","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Circuit","category":"page"},{"location":"api/circuit/#Quac.Circuit","page":"Circuit","title":"Quac.Circuit","text":"A quantum circuit implementation using multi-priority queues.\n\nQueues are gate-buffers in qubit lanes.\nMulti-priority numbers can be retrieved procedurally from gate-lanes encoded inside the gates of the queues.\n\n\n\n\n\n","category":"type"},{"location":"api/circuit/#Methods","page":"Circuit","title":"Methods","text":"","category":"section"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Pages = [\"circuit.md\"]\nOrder = [:function]","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Base.adjoint(::Circuit)\nBase.hcat(::Circuit...)\nBase.isempty(::Circuit)\nBase.iterate(::Circuit)\nBase.length(::Circuit)\nBase.push!(::Circuit, ::Gate)\nBase.vcat(::Circuit...)\nconnectivity\nlanes(::Circuit)\nmoments","category":"page"},{"location":"api/circuit/#Base.adjoint-Tuple{Circuit}","page":"Circuit","title":"Base.adjoint","text":"Base.adjoint(circuit)\n\nRetrieve the adjoint circuit which fulfills the following equality.\n\ncircuit * circuit' == I(n)\n\nNotes\n\nIf all gates are hermitian, then the following equality also holds.\n\ncircuit * circuit' == circuit' * circuit == I(n)\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.hcat-Tuple{Vararg{Circuit}}","page":"Circuit","title":"Base.hcat","text":"hcat(circuits::Circuit...)\n\nJoin circuits in the temporal dimension.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.isempty-Tuple{Circuit}","page":"Circuit","title":"Base.isempty","text":"isempty(circuit)\n\nCheck whether the circuit contains any gate.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.iterate-Tuple{Circuit}","page":"Circuit","title":"Base.iterate","text":"Base.iterate(circuit::Circuit[, state])\n\nRetrieves next gate from state by travelling through a topologically sorted path.\n\nArguments\n\ncircuit::Circuit\nstate (or head) should be a NTuple{N, Int} where N is the number of lanes. Each element is a pointer to the next gate on each lane.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.length-Tuple{Circuit}","page":"Circuit","title":"Base.length","text":"length(circuit)\n\nReturn the number of gates in a circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.push!-Tuple{Circuit, Gate}","page":"Circuit","title":"Base.push!","text":"push!(circuit, gate...)\n\nAppends a gate to the circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.vcat-Tuple{Vararg{Circuit}}","page":"Circuit","title":"Base.vcat","text":"vcat(circuits::Circuit...)\n\nJoin circuits in the spatial dimension.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Quac.connectivity","page":"Circuit","title":"Quac.connectivity","text":"connectivity([f,] circuit)\n\nGenerate connectivity graph between qubits.\n\nArguments\n\nf: Function to filter gates from circuit.\ncircuit: Circuit.\n\n\n\n\n\n","category":"function"},{"location":"api/circuit/#Quac.lanes-Tuple{Circuit}","page":"Circuit","title":"Quac.lanes","text":"lanes(circuit)\n\nReturn the number of qubit lanes in a circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Quac.moments","page":"Circuit","title":"Quac.moments","text":"moments(circuit)\n\nReturn moments (lists of gates that can execute at the same time) of the circuit.\n\n\n\n\n\n","category":"function"}] +[{"location":"api/gates/#Gates","page":"Gates","title":"Gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"DocTestSetup = quote\n using Quac\n using LinearAlgebra\nend","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"In Quac, gates are symbolic, i.e. they do not store their representation. A gate instance just stores the qubit lane in which it acts and its parameters if needed. Thanks to Julia's multiple-dispatch different representations can be queried lazily from type information.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"For example, this is a Z that acts on qubit 4.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> gate = Z(4)\nZ(4)","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Any gate can be represented by a dense matrix.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Matrix(gate)\n2×2 Matrix{ComplexF32}:\n 1.0+0.0im 0.0+0.0im\n 0.0+0.0im -1.0+0.0im","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"You can even specify the eltype!","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Matrix{Int}(gate)\n2×2 Matrix{Int64}:\n 1 0\n 0 -1","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Furthermore, the Z gate allows a Diagonal representation!","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"julia> Diagonal{Float32}(gate)\n2×2 Diagonal{Float32, Vector{Float32}}:\n 1.0 ⋅\n ⋅ -1.0","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Operator\nGate","category":"page"},{"location":"api/gates/#Quac.Operator","page":"Gates","title":"Quac.Operator","text":"Operator\n\nParent type of quantum operators.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Gate","page":"Gates","title":"Quac.Gate","text":"Gate{Operator}(lanes...; parameters...)\n\nAn Operator located at some lanes and configured with some parameters.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Pauli-gates","page":"Gates","title":"Pauli gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Quac.I\nX\nY\nZ","category":"page"},{"location":"api/gates/#Quac.I","page":"Gates","title":"Quac.I","text":"I(lane)\n\nThe σ_0 Pauli matrix gate.\n\nNote\n\nDue to name clashes with LinearAlgebra.I, Quac.I is not exported by default.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.X","page":"Gates","title":"Quac.X","text":"X(lane)\n\nThe σ_1 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Y","page":"Gates","title":"Quac.Y","text":"Y(lane)\n\nThe σ_2 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Z","page":"Gates","title":"Quac.Z","text":"Z(lane)\n\nThe σ_3 Pauli matrix gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Hadamard-gate","page":"Gates","title":"Hadamard gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"H","category":"page"},{"location":"api/gates/#Quac.H","page":"Gates","title":"Quac.H","text":"H(lane)\n\nThe Hadamard gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Phase-gates","page":"Gates","title":"Phase gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"S\nSd\nT\nTd","category":"page"},{"location":"api/gates/#Quac.S","page":"Gates","title":"Quac.S","text":"S(lane)\n\nThe S gate or fracπ2 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Sd","page":"Gates","title":"Quac.Sd","text":"Sd(lane)\n\nThe S^dagger gate or -fracπ2 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.T","page":"Gates","title":"Quac.T","text":"T(lane)\n\nThe T gate or fracπ4 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Td","page":"Gates","title":"Quac.Td","text":"Td(lane)\n\nThe T^dagger gate or -fracπ4 rotation around Z-axis.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Rotation-gates","page":"Gates","title":"Rotation gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Rx\nRy\nRz\nRxx\nRyy\nRzz","category":"page"},{"location":"api/gates/#Quac.Rx","page":"Gates","title":"Quac.Rx","text":"Rx(lane, θ)\n\nThe theta rotation around the X-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Ry","page":"Gates","title":"Quac.Ry","text":"Ry(lane, θ)\n\nThe theta rotation around the Y-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rz","page":"Gates","title":"Quac.Rz","text":"Rz(lane, θ)\n\nThe theta rotation around the Z-axis gate.\n\nNotes\n\nThe U1 gate is an alias of Rz.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rxx","page":"Gates","title":"Quac.Rxx","text":"Rxx(lane1, lane2, θ)\n\nThe theta rotation around the XX-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Ryy","page":"Gates","title":"Quac.Ryy","text":"Ryy(lane1, lane2, θ)\n\nThe theta rotation around the YY-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.Rzz","page":"Gates","title":"Quac.Rzz","text":"Rzz(lane1, lane2, θ)\n\nThe theta rotation around the ZZ-axis gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#General-U2,-U3-gates","page":"Gates","title":"General U2, U3 gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"U2\nU3","category":"page"},{"location":"api/gates/#Quac.U2","page":"Gates","title":"Quac.U2","text":"U2(lane, ϕ, λ)\n\nThe U2 gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Quac.U3","page":"Gates","title":"Quac.U3","text":"U3(lane, θ, ϕ, λ)\n\nThe U3 gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Controlled-gates","page":"Gates","title":"Controlled gates","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Control","category":"page"},{"location":"api/gates/#Quac.Control","page":"Gates","title":"Quac.Control","text":"Control(lane, op::Gate)\n\nA controlled gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#SWAP-gate","page":"Gates","title":"SWAP gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Swap","category":"page"},{"location":"api/gates/#Quac.Swap","page":"Gates","title":"Quac.Swap","text":"Swap(lane1, lane2)\n\nThe SWAP gate.\n\n\n\n\n\n","category":"type"},{"location":"api/gates/#Special-Unitary-gate","page":"Gates","title":"Special Unitary gate","text":"","category":"section"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"warn: Experimental interface\nThis interface is experimental and may change in the future.","category":"page"},{"location":"api/gates/","page":"Gates","title":"Gates","text":"Quac.SU{N}","category":"page"},{"location":"api/gates/#Quac.SU","page":"Gates","title":"Quac.SU","text":"SU(N)(lane_1, lane_2, ..., lane_log2(N))\n\nThe SU{N} multi-qubit general unitary gate that can be used to represent any unitary matrix that acts on log2(N) qubits. A new random SU{N} can be created with rand(SU{N}, lanes...), where N is the dimension of the unitary matrix and lanes are the qubit lanes on which the gate acts.\n\n\n\n\n\n","category":"type"},{"location":"ecosystem/#Ecosystem","page":"Ecosystem","title":"Ecosystem","text":"","category":"section"},{"location":"ecosystem/#Tenet","page":"Ecosystem","title":"Tenet","text":"","category":"section"},{"location":"ecosystem/","page":"Ecosystem","title":"Ecosystem","text":"Tenet is a Tensor Network library focused on expressibility, flexibility and speed. It leverages Julia's multiple dispatch and parametric typing to specialize functions depending on the ansatz (MPS, PEPS, ...) such as contraction path search, tensor contraction, ...","category":"page"},{"location":"ecosystem/#Gato","page":"Ecosystem","title":"Gato","text":"","category":"section"},{"location":"ecosystem/","page":"Ecosystem","title":"Ecosystem","text":"Gato is a Statevector (aka Schrödinger-like) simulator.","category":"page"},{"location":"#Quac.jl","page":"Home","title":"Quac.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Quac stands for Quantum circuits and it's a library for quantum circuit representation in Julia. It serves as the core library of multiple libraries related to quantum computing: simulators, hardware controllers, ...","category":"page"},{"location":"","page":"Home","title":"Home","text":"Quac is not a simulator or a controller, but it provides the tools to build them.","category":"page"},{"location":"#Features","page":"Home","title":"Features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Multiple representation of gates Gates are symbolic in Quac, and thanks to Julia's multiple-dispatch, they posess multiple representations like dense arrays, diagonal matrices, ...\n(New) compact and efficient description of circuits Unlike other libraries, Quac uses multi-priority queues as the underlying data-structure.\nSVG rendering of quantum circuits","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: \"4-qubit Quantum Fourier Transform\")","category":"page"},{"location":"","page":"Home","title":"Home","text":"Extensibility Every part of the package is extensible with new types or functionality as you wish.","category":"page"},{"location":"#Contents","page":"Home","title":"Contents","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"api/algorithms/#Algorithms","page":"Algorithms","title":"Algorithms","text":"","category":"section"},{"location":"api/algorithms/","page":"Algorithms","title":"Algorithms","text":"Quac.Algorithms.QFT","category":"page"},{"location":"api/algorithms/#Quac.Algorithms.QFT","page":"Algorithms","title":"Quac.Algorithms.QFT","text":"QFT(n)\n\nGenerate a Quantum Fourier Transform circuit of n qubits.\n\n\n\n\n\n","category":"function"},{"location":"api/circuit/#Circuit","page":"Circuit","title":"Circuit","text":"","category":"section"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Quantum circuits can be seen as DAGs (Direct Acyclic Graphs) in which the width of the DAG is constant and equal to the number of qubits. Also the indgree and outdegree of quantum gates must always be equal. But many state-of-art quantum circuit libraries use either (a) lists of moments of gates or (b) graphs for representing them, which do not exploit the sparsity of the circuit or already make decisions about their layout (thus not having a layout-independent representation).","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Instead Quac uses multi-priority queues to store gates: there is a queue per qubit lane that stores the gates that act on it, and priorities are the order in which they are applied. If a gate acts on multiple qubits, it will contain a priority per qubit. This data structure allows us to store gates in the most compact way while iterating on gates, reversing the circuit, ... are still efficient. It appears to be the perfect data structure for quantum circuits.","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"tip: Was this really necessary?\nNo, the bottleneck of quantum circuits is not on their representation but when reading the source code of other quantum circuit libraries, I wasn't convinced by their solutions: graphs, already laid out lists of lists, a serialized list of gates, ... So I came up with multi-priority queues which seem like the perfect fit and as a consequence, the implementation is simple yet efficient.","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Circuit","category":"page"},{"location":"api/circuit/#Quac.Circuit","page":"Circuit","title":"Quac.Circuit","text":"A quantum circuit implementation using multi-priority queues.\n\nQueues are gate-buffers in qubit lanes.\nMulti-priority numbers can be retrieved procedurally from gate-lanes encoded inside the gates of the queues.\n\n\n\n\n\n","category":"type"},{"location":"api/circuit/#Methods","page":"Circuit","title":"Methods","text":"","category":"section"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Pages = [\"circuit.md\"]\nOrder = [:function]","category":"page"},{"location":"api/circuit/","page":"Circuit","title":"Circuit","text":"Base.adjoint(::Circuit)\nBase.hcat(::Circuit...)\nBase.isempty(::Circuit)\nBase.iterate(::Circuit)\nBase.length(::Circuit)\nBase.push!(::Circuit, ::Gate)\nBase.vcat(::Circuit...)\nconnectivity\nlanes(::Circuit)\nmoments","category":"page"},{"location":"api/circuit/#Base.adjoint-Tuple{Circuit}","page":"Circuit","title":"Base.adjoint","text":"Base.adjoint(circuit)\n\nRetrieve the adjoint circuit which fulfills the following equality.\n\ncircuit * circuit' == I(n)\n\nNotes\n\nIf all gates are hermitian, then the following equality also holds.\n\ncircuit * circuit' == circuit' * circuit == I(n)\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.hcat-Tuple{Vararg{Circuit}}","page":"Circuit","title":"Base.hcat","text":"hcat(circuits::Circuit...)\n\nJoin circuits in the temporal dimension.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.isempty-Tuple{Circuit}","page":"Circuit","title":"Base.isempty","text":"isempty(circuit)\n\nCheck whether the circuit contains any gate.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.iterate-Tuple{Circuit}","page":"Circuit","title":"Base.iterate","text":"Base.iterate(circuit::Circuit[, state])\n\nRetrieves next gate from state by travelling through a topologically sorted path.\n\nArguments\n\ncircuit::Circuit\nstate (or head) should be a NTuple{N, Int} where N is the number of lanes. Each element is a pointer to the next gate on each lane.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.length-Tuple{Circuit}","page":"Circuit","title":"Base.length","text":"length(circuit)\n\nReturn the number of gates in a circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.push!-Tuple{Circuit, Gate}","page":"Circuit","title":"Base.push!","text":"push!(circuit, gate...)\n\nAppends a gate to the circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Base.vcat-Tuple{Vararg{Circuit}}","page":"Circuit","title":"Base.vcat","text":"vcat(circuits::Circuit...)\n\nJoin circuits in the spatial dimension.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Quac.connectivity","page":"Circuit","title":"Quac.connectivity","text":"connectivity([f,] circuit)\n\nGenerate connectivity graph between qubits.\n\nArguments\n\nf: Function to filter gates from circuit.\ncircuit: Circuit.\n\n\n\n\n\n","category":"function"},{"location":"api/circuit/#Quac.lanes-Tuple{Circuit}","page":"Circuit","title":"Quac.lanes","text":"lanes(circuit)\n\nReturn the number of qubit lanes in a circuit.\n\n\n\n\n\n","category":"method"},{"location":"api/circuit/#Quac.moments","page":"Circuit","title":"Quac.moments","text":"moments(circuit)\n\nReturn moments (lists of gates that can execute at the same time) of the circuit.\n\n\n\n\n\n","category":"function"}] }