Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipVinc committed Jun 4, 2019
1 parent 30e3608 commit 096f47b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
Neural-Network representations of mixed quantum states and to find the Steady-
State of dissipative Quantum Systems with variational Montecarlo schemes.

This code has been developed while working on [Variational neural network ansatz for steady states in open quantum systems](https://arxiv.org/abs/1902.10104)

## Installation
To Install `NeuralQuantum.jl`, please run the following commands to install all
To Install `NeuralQuantum.jl`, run the following commands to install all
dependencies:
```
using Pkg
pkg"add https://github.com/PhilipVinc/QuantumLattices.jl"
pkg"add https://github.com/PhilipVinc/ValueHistoriesLogger.jl"
pkg"add https://github.com/PhilipVinc/NeuralQuantum.jl"
```
If you are wondering what all those packages are for, here's an explanation:
Those packages are needed for the following reasons:
- `QuantumLattices` is a custom package that allows defining new types of operators on a lattice. It's not needed natively but it is usefull to define hamiltonians on a lattice.
- `Optimisers`, a custom version of the still unreleased `FluxML/Optimisers.jl`, with features that are not yet released in the original branch.
- `ValueHistoriesLogger` custom logger for logging arbitrary values

## Example
```
# Load dependencies
using NeuralQuantum, QuantumLattices, Optimisers
using NeuralQuantum, QuantumLattices
using Printf, ValueHistoriesLogger, Logging, ValueHistories
# Select the numerical precision
Expand Down
14 changes: 14 additions & 0 deletions src/States/NAryState.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ IntegerToState(n_sites, loc_dim, val, T::Type{<:Number}) =
end
arr
end

# --- Indexing function for local spaces used in operators
local_index(s::NAryState, i::T) where {T<:Integer} =
T(s.σ[i])+1

function local_index(s::NAryState{T,Nb}, is::Vector{T2}) where {T,Nb,T2<:Integer}
idx = 0
for (i, j)=enumerate(reverse(is))
idx += T2(s.σ[i]) * Nb^(j-1)
end
return idx + 1
end
# -- end

# -------------- Base.show extension for nice printing -------------- #
Base.show(io::IO, ::MIME"text/plain", bs::NAryState) = print(io, "NAryState(",bs.n,") : ", String(bs.σ,false),
" = ", bs.i_σ)
Expand Down

0 comments on commit 096f47b

Please sign in to comment.