-
Notifications
You must be signed in to change notification settings - Fork 41
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
Docs update I #101
Docs update I #101
Changes from 10 commits
6b8f9c2
96fe127
ff672bc
3d4d347
f0d4c1f
9940767
2c35c92
b4f0c70
288ed62
735eacf
ab506d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
""" | ||
randuniform([::Type{T}=Float64], dims::Dims{N}) -> Array{T,N} | ||
|
||
Create an array of size `dims` with random entries uniformly distributed in the allowed | ||
values of `T`. | ||
|
||
See also [`randnormal`](@ref), [`randisometry`](@ref) and[`randhaar`](@ref). | ||
""" | ||
randuniform(dims::Base.Dims) = randuniform(Float64, dims) | ||
randuniform(::Type{T}, dims::Base.Dims) where {T<:Number} = rand(T, dims) | ||
|
||
""" | ||
randnormal([::Type{T}=Float64], dims::Dims{N}) -> Array{T,N} | ||
|
||
Create an array of size `dims` with random entries normally distributed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The normal distribution with mean zero and standard deviation one is typically called the standard normal distribution, so maybe we should try to get this in. |
||
|
||
See also [`randuniform`](@ref), [`randisometry`](@ref) and[`randhaar`](@ref). | ||
""" | ||
randnormal(dims::Base.Dims) = randnormal(Float64, dims) | ||
randnormal(::Type{T}, dims::Base.Dims) where {T<:Number} = randn(T, dims) | ||
|
||
""" | ||
randisometry([::Type{T}=Float64], dims::Dims{2}) -> Array{T,2} | ||
randhaar([::Type{T}=Float64], dims::Dims{2}) -> Array{T,2} | ||
|
||
Create a random isometry of size `dims`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess here you can mention the Haar measure or uniform measure over the compact manifold of isometric matrices. |
||
|
||
See also [`randuniform`](@ref) and [`randnormal`](@ref). | ||
""" | ||
randisometry(dims::Base.Dims{2}) = randisometry(Float64, dims) | ||
function randisometry(::Type{T}, dims::Base.Dims{2}) where {T<:Number} | ||
return dims[1] >= dims[2] ? _leftorth!(randnormal(T, dims), QRpos(), 0)[1] : | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -605,6 +605,14 @@ function planar_trace(f₁::FusionTree{I}, f₂::FusionTree{I}, | |
return newtrees | ||
end | ||
|
||
""" | ||
planar_trace(f::FusionTree{I,N}, q1::IndexTuple{N₃}, q2::IndexTuple{N₃}) where {I<:Sector,N,N₃} | ||
-> <:AbstractDict{FusionTree{I,N-2*N₃}, <:Number} | ||
|
||
Perform a planar trace of the uncoupled indices of the fusion tree `f` at `q1` with those at | ||
`q2`, which are required to be pairwise neighbouring. The result is returned as a dictionary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pairwise neighbouring might be a bit confusing, as there are different ways in which traces of several indices can be planar: It could for example be that q2[1] = q1[1]+1 and q2[2] = q1[2]+1, but also that q2[2] = q1[2]-3 , namely with q2[2] = q2[1] +1 = q1[1]+2 = q1[2] + 3 |
||
of output trees and corresponding coefficients. | ||
""" | ||
function planar_trace(f::FusionTree{I,N}, | ||
q1::IndexTuple{N₃}, q2::IndexTuple{N₃}) where {I<:Sector,N,N₃} | ||
u = one(I) | ||
|
@@ -652,6 +660,13 @@ function planar_trace(f::FusionTree{I,N}, | |
end | ||
|
||
# trace two neighbouring indices of a single fusion tree | ||
""" | ||
elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N} -> <:AbstractDict{FusionTree{I,N-2}, <:Number} | ||
|
||
Perform an elementary trace of neighbouring uncoupled indices `i` and | ||
`i+1` on a fusion tree `f`, and returns the result as a dictionary of output trees and | ||
corresponding coefficients. | ||
""" | ||
function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N} | ||
(N > 1 && 1 <= i <= N) || | ||
throw(ArgumentError("Cannot trace outputs i=$i and i+1 out of only $N outputs")) | ||
|
@@ -745,7 +760,7 @@ end | |
# -> manipulations that depend on a braiding | ||
# -> requires both Fsymbol and Rsymbol | ||
""" | ||
artin_braid(f::FusionTree, i; inv::Bool = false) -> <:AbstractDict{typeof(t), <:Number} | ||
artin_braid(f::FusionTree, i; inv::Bool = false) -> <:AbstractDict{typeof(f), <:Number} | ||
|
||
Perform an elementary braid (Artin generator) of neighbouring uncoupled indices `i` and | ||
`i+1` on a fusion tree `f`, and returns the result as a dictionary of output trees and | ||
|
@@ -755,7 +770,7 @@ The keyword `inv` determines whether index `i` will braid above or below index ` | |
applying `artin_braid(f′, i; inv = true)` to all the outputs `f′` of | ||
`artin_braid(f, i; inv = false)` and collecting the results should yield a single fusion | ||
tree with non-zero coefficient, namely `f` with coefficient `1`. This keyword has no effect | ||
if `BraidingStyle(sectortype(f)) isa SymmetricBraiding`. | ||
if `BraidingStyle(sectortype(f)) isa SymmetricBraiding`. | ||
""" | ||
function artin_braid(f::FusionTree{I,N}, i; inv::Bool=false) where {I<:Sector,N} | ||
1 <= i < N || | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,16 +62,20 @@ | |
Base.values(::Type{I}) where {I<:Sector} = SectorValues{I}() | ||
|
||
# Define a sector for ungraded vector spaces | ||
struct Trivial <: Sector | ||
end | ||
""" | ||
Trivial | ||
|
||
Singleton type to represent the trivial sector, i.e. the unit element of the group | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can get a bit confusing. The trivial group has only a unit element, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it could also be mentioned that this is the unit object of the category Vect of ordinary vector spaces (not as the first sentence). |
||
(category) with a single object. | ||
""" | ||
struct Trivial <: Sector end | ||
Base.show(io::IO, ::Trivial) = print(io, "Trivial()") | ||
|
||
Base.IteratorSize(::Type{SectorValues{Trivial}}) = HasLength() | ||
Base.length(::SectorValues{Trivial}) = 1 | ||
Base.iterate(::SectorValues{Trivial}, i=false) = return i ? nothing : (Trivial(), true) | ||
function Base.getindex(::SectorValues{Trivial}, i::Int) | ||
return i == 1 ? Trivial() : | ||
throw(BoundsError(values(Trivial), i)) | ||
return i == 1 ? Trivial() : throw(BoundsError(values(Trivial), i)) | ||
end | ||
findindex(::SectorValues{Trivial}, c::Trivial) = 1 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniform is typically understood to be the uniform distribution on [0,1]. It is definitely not uniform over all values of
T
(which would not even be well defined).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I got confused by not reading the docstring of
rand
far enough:I am wondering though if this method really makes sense, as it is just a copy of
rand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not, but this also applies to
randnormal
which is just equal torandn
.