Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some missing interface explanations to devdocs #43

Merged
merged 7 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Quantikz = "b0d11df0-eea3-4d79-b4a5-421488cbf74b"
QuantumClifford = "0525e862-1e90-11e9-3e4d-1b39d7109de1"
QuantumOptics = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c"
QuantumOpticsBase = "4f57444f-1401-5e15-980d-4471b28d5678"
QuantumSavory = "2de2e421-972c-4cb5-a0c3-999c85908079"
QuantumSymbolics = "efa7fd63-0460-4890-beb7-be1bbdfbaeae"
ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ DocMeta.setdocmeta!(QuantumSavory, :DocTestSetup, :(using QuantumSavory); recurs
function main()
bib = CitationBibliography(joinpath(@__DIR__,"src/references.bib"), style=:authoryear)
makedocs(
bib,
plugins = [bib],
doctest = false,
clean = true,
# strict = Documenter.except(:missing_docs), TODO
warnonly = true, # TODO [:missing_docs],
sitename = "QuantumSavory.jl",
format = Documenter.HTML(
assets=["assets/init.js"]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ @article{krastanov2019optimised

@article{naomi2013topological,
title={Topological quantum computing with a very noisy network and local error rates approaching one percent},
author={Naomi H. Nickerson, Ying Li, Simon C. Benjamin},
author={Naomi H. Nickerson, Ying Li, and Simon C. Benjamin},
url={https://www.nature.com/articles/ncomms2773},
year={2013},
journal={Nature}
Expand Down
136 changes: 132 additions & 4 deletions docs/src/register_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,51 @@ flowchart TB

## `project_traceout!`

TODO
#### `project_traceout!(r::RegRef, basis; time)`

Project the state in `RegRef` on `basis` at a specified `time`. `basis` can be a `Vector` or `Tuple` of basis states, or it can be a `Matrix` like `Z` or `X`.

#### `project_traceout(reg::Register, i::Int, basis; time)`

Project the state in the slot in index `i` of `Register` on `basis` at a specified `time`. `basis` can be a `Vector` or `Tuple` of basis states, or it can be a `Matrix` like `Z` or `X`.

#### `project_traceout!(f, r::RegRef, basis; time)`

Project the state in `RegRef` on `basis` at a specified `time` and apply function `f` on the projected basis state. `basis` can be a `Vector` or `Tuple` of basis states, or it can be a `Matrix` like `Z` or `X`.

#### `project_traceout!(f, reg::Register, i::Int, basis; time)`

Project the state in the slot in index `i` of `Register` on `basis` at a specified `time` and apply function `f` on the projected basis state. `basis` can be a `Vector` or `Tuple` of basis states, or it can be a `Matrix` like `Z` or `X`.
Lowers the representation from registers to states.

#### `project_traceout!(state, stateindex, basis::Symbolic{AbstractOperator})` and `basis::AbstractVecOrTuple{<:Symbolic{AbstractKet}}`

Backend implementations.
If `basis` is an operator, call `eigvecs` to convert it into a matrix whose columns are the eigenvectors of the operator.
If `basis` is a `Vector` or `Tuple` of `Symbolic` basis states, call `express` to convert it to the necessary representation.

#### Interface Overview

```@raw html
<div class="mermaid">
flowchart TB
A["<code>project_traceout!(r::RegRef, basis; time)</code>"]
B["<code>project_traceout!(reg::Register, i::Int, basis; time)</code>"]
subgraph TOP [lower from registers to states]
direction LR
D1["<code>reg.staterefs[i].state[]</code>"]
D2["<code>reg.stateindices[i]</code>"]
end
E1["<code>basis::Symbolic{AbstractOperator}</code>"]
F1["<code>eigvecs(basis)</code>"]
E2["<code>basis::Base.AbstractVecOrTuple{<:Symbolic{AbstractKet}}</code>"]
F2["<code>express.(basis)</code>"]
G([Dispatch on state to low level implementation<br>in an independent library])
A --> B --> TOP
TOP --> E1 --> F1 --> G
TOP --> E2 --> F2 --> G
</div>
```

## `traceout!`

Expand Down Expand Up @@ -213,12 +257,96 @@ flowchart TB

## `uptotime!`

TODO
#### `uptotime!(ref::RegRef, now)`

Evolve the state in a `RegRef` upto a given time `now`

#### `uptotime!(refs::Base.AbstractVecOrTuple{RegRef}, now)`

Evolve the state represented by the given `RegRef`s upto a time `now`

#### `uptotime!(registers, indices::Base.AbstractVecOrTuple{Int}, now)`

Evolve the state of all the given `registers` at the slots represented by `indices` upto a time `now`

#### `uptotime!(stateref::StateRef, idx::Int, background, Δt)`

Evolve a `StateRef` at index `idx` with given `background` and `Δt`

#### `uptotime!(state, indices::Base.AbstractVecOrTuple{Int}, backgrounds, Δt)`

Evolve `state` at `indices` given `backgrounds` and `Δt`

#### `uptotime!(state::QuantumClifford.MixedDestabilizer, idx::Int, background, Δt)`

Low level implementation to compute the result of `uptotime!` for states using Clifford representation

#### `uptotime!(state::StateVector, idx::Int, background, Δt)`

Low level implementation to compute the result of `uptotime!` for states using Ket representation. The `state` in ket representation is converted to a density matrix before calling the `uptotime!` for final computation.

#### `uptotime!(state::Operator, idx::Int, background, Δt)`

Low level implementation to compute the result of `uptotime!` for `Operator`

#### Interface Overview

```@raw html
<div class="mermaid">
flowchart TB
A["<code>uptotime!(ref::RegRef, now)</code>"]
B["<code>uptotime!(refs::Base.AbstractVecOrTuple{RegRef}, now)</code>"]
C["<code>uptotime!(registers, indices::Base.AbstractVecOrTuple{Int}, now)</code>"]
C1["lower from registers to states"]
D["<code>uptotime!(stateref::StateRef, idx::Int, background, Δt)</code>"]
E["<code>uptotime!(state, indices::Base.AbstractVecOrTuple{Int}, backgrounds, Δt)</code>"]
A --> C
B --> C
C --> C1
C1 --> E
D --> E
F([Dispatch on state to low level implementation<br>in an independent library])
E --> F
</div>
```

## `swap!`

TODO
#### `swap!(r1::RegRef, r2::RegRef)`

Swap the state of the given `RegRef`s

#### `swap!(reg1::Register, reg2::Register, i1::Int, i2::Int)`
Swap the state stored in the two `Registers` at slots `i1` and `i2` respectively

#### Interface Overview

```@raw html
<div class="mermaid">
flowchart TB
A["<code>swap!(r1::RegRef, r2::RegRef)</code>"]
B["<code>swap!(reg1::Register, reg2::Register, i1::Int, i2::Int)</code>"]
A --> B
</div>
```

## `overwritetime!`

TODO
#### `overwritetime!(refs::Base.AbstractVecOrTuple{RegRef}, now)`

Overwrite the time of the simulation for the given references to `now`

#### `overwritetime!(registers, indices, now)`

Overwrite the time of the simulation for the given `registers` at `indices` to `now`

#### Interface Overview

```@raw html
<div class="mermaid">
flowchart TB
A["<code>overwritetime!(refs::Base.AbstractVecOrTuple{RegRef}, now)</code>"]
B["<code>overwritetime!(registers, indices, now)</code>"]
A --> B
</div>
```