mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-15 03:33:42 +02:00
Added documentation fro Groups module
This commit is contained in:
parent
63ff01a2be
commit
208d03d245
11 changed files with 294 additions and 31 deletions
|
@ -16,15 +16,39 @@
|
|||
using CUDA, Random
|
||||
|
||||
SU2(a::T, b::T) where T <: AbstractFloat = SU2{T}(complex(a), complex(b))
|
||||
|
||||
"""
|
||||
inverse(g::T) where T <: Group
|
||||
|
||||
Returns the group inverse of `g`.
|
||||
"""
|
||||
inverse(b::SU2{T}) where T <: AbstractFloat = SU2{T}(conj(b.t1), -b.t2)
|
||||
|
||||
"""
|
||||
dag(g::T) where T <: Group
|
||||
|
||||
Returns the group inverse of `g`.
|
||||
"""
|
||||
dag(a::SU2{T}) where T <: AbstractFloat = inverse(a)
|
||||
norm(a::SU2{T}) where T <: AbstractFloat = sqrt(abs2(a.t1) + abs2(a.t2))
|
||||
norm2(a::SU2{T}) where T <: AbstractFloat = abs2(a.t1) + abs2(a.t2)
|
||||
tr(g::SU2{T}) where T <: AbstractFloat = complex(2.0*real(g.t1), 0.0)
|
||||
|
||||
"""
|
||||
tr(g::T) where T <: Group
|
||||
|
||||
Returns the trace of the groups element `g`.
|
||||
"""
|
||||
tr(g::SU2{T}) where T <: AbstractFloat = complex(2*real(g.t1), 0.0)
|
||||
|
||||
"""
|
||||
dev_one(T) where T <: Group
|
||||
|
||||
Returns the distance to the unit group element
|
||||
"""
|
||||
dev_one(g::SU2{T}) where T <: AbstractFloat = sqrt(( abs2(g.t1 - one(T)) + abs2(g.t2))/2)
|
||||
|
||||
"""
|
||||
function unitarize(a::T) where {T <: Group}
|
||||
unitarize(a::T) where {T <: Group}
|
||||
|
||||
Return a unitarized element of the group.
|
||||
"""
|
||||
|
@ -40,6 +64,11 @@ Base.:*(a::SU2{T},b::SU2{T}) where T <: AbstractFloat = SU2{T}(a.t1*b.t1-a.t2*co
|
|||
Base.:/(a::SU2{T},b::SU2{T}) where T <: AbstractFloat = SU2{T}(a.t1*conj(b.t1)+a.t2*conj(b.t2),-a.t1*b.t2+a.t2*b.t1)
|
||||
Base.:\(a::SU2{T},b::SU2{T}) where T <: AbstractFloat = SU2{T}(conj(a.t1)*b.t1+a.t2*conj(b.t2),conj(a.t1)*b.t2-a.t2*conj(b.t1))
|
||||
|
||||
"""
|
||||
isgroup(g::T) where T <: Group
|
||||
|
||||
Returns `true` if `g` is a group element, `false` otherwise.
|
||||
"""
|
||||
function isgroup(a::SU2{T}) where T <: AbstractFloat
|
||||
tol = 1.0E-10
|
||||
if (abs2(a.t1) + abs2(a.t2) - 1.0 < 1.0E-10)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue