mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 19:23:42 +02:00
Addition of SU2fund
This commit is contained in:
parent
d7e63ebdf2
commit
1b57d86c79
6 changed files with 131 additions and 9 deletions
|
@ -54,14 +54,27 @@ struct DiracWorkspace{T}
|
||||||
|
|
||||||
function DiracWorkspace(::Type{G}, ::Type{T}, lp::SpaceParm{4,6,B,D}) where {G,T <: AbstractFloat, B,D}
|
function DiracWorkspace(::Type{G}, ::Type{T}, lp::SpaceParm{4,6,B,D}) where {G,T <: AbstractFloat, B,D}
|
||||||
|
|
||||||
sr = scalar_field(Spinor{4,G}, lp)
|
@timeit "Allocating DiracWorkspace" begin
|
||||||
sp = scalar_field(Spinor{4,G}, lp)
|
if G == SU3fund
|
||||||
sAp = scalar_field(Spinor{4,G}, lp)
|
sr = scalar_field(Spinor{4,G}, lp)
|
||||||
st = scalar_field(Spinor{4,G}, lp)
|
sp = scalar_field(Spinor{4,G}, lp)
|
||||||
|
sAp = scalar_field(Spinor{4,G}, lp)
|
||||||
|
st = scalar_field(Spinor{4,G}, lp)
|
||||||
|
csw = tensor_field(U3alg{T},lp)
|
||||||
|
end
|
||||||
|
|
||||||
csw = tensor_field(U3alg{T},lp)
|
if G == SU2fund
|
||||||
|
sr = scalar_field(Spinor{4,G}, lp)
|
||||||
|
sp = scalar_field(Spinor{4,G}, lp)
|
||||||
|
sAp = scalar_field(Spinor{4,G}, lp)
|
||||||
|
st = scalar_field(Spinor{4,G}, lp)
|
||||||
|
csw = tensor_field(U2alg{T},lp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return new{T}(sr,sp,sAp,st,csw,cs)
|
return new{T}(sr,sp,sAp,st,csw,cs)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
20
src/Groups/AlgebraU2.jl
Normal file
20
src/Groups/AlgebraU2.jl
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct U2alg{T} <: Algebra
|
||||||
|
u11::T
|
||||||
|
u22::T
|
||||||
|
u12::Complex{T}
|
||||||
|
end
|
||||||
|
|
||||||
|
function antsym(a::SU2{T}) where T <: AbstractFloat
|
||||||
|
return U2alg{T}(2.0*imag(a.t1),-2.0*imag(a.t1),2.0*a.t2)
|
||||||
|
end
|
||||||
|
|
||||||
|
Base.:*(a::U2alg{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(im*a.u11*b.t1 + a.u12*b.t2,
|
||||||
|
-conj(a.u12)*b.t1 + im*a.u22*b.t2)
|
||||||
|
|
||||||
|
Base.:+(a::U2alg{T},b::U2alg{T}) where T <: AbstractFloat = U2alg{T}(a.u11 + b.u11, a.u22 + b.u22, a.u12 + b.u12)
|
||||||
|
|
||||||
|
Base.:*(r::Number, a::U2alg{T}) where T <: AbstractFloat = U2alg{T}(r*a.u11, r*a.u22, r*a.u12)
|
||||||
|
|
76
src/Groups/FundamentalSU2.jl
Normal file
76
src/Groups/FundamentalSU2.jl
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
|
||||||
|
|
||||||
|
Base.zero(::Type{SU2fund{T}}) where T <: AbstractFloat = SU2fund{T}(zero(T),zero(T))
|
||||||
|
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2fund{T}}) where T <: AbstractFloat = SU2fund{T}(complex(randn(rng,T),randn(rng,T)),
|
||||||
|
complex(randn(rng,T),randn(rng,T)))
|
||||||
|
|
||||||
|
|
||||||
|
SU2fund(a::T, b::T) where T <: AbstractFloat = SU2fund{T}(complex(a), complex(b))
|
||||||
|
|
||||||
|
"""
|
||||||
|
dag(a::SU2fund{T})
|
||||||
|
|
||||||
|
Returns the conjugate of a fundamental element.
|
||||||
|
"""
|
||||||
|
dag(a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(conj(a.t1), conj(a.t2))
|
||||||
|
|
||||||
|
"""
|
||||||
|
norm(a::SU2fund{T})
|
||||||
|
|
||||||
|
Returns the norm of a fundamental element. Same result as dot(a,a).
|
||||||
|
"""
|
||||||
|
norm(a::SU2fund{T}) where T <: AbstractFloat = sqrt((abs2(a.t1) + abs2(a.t2)))
|
||||||
|
|
||||||
|
"""
|
||||||
|
norm(a::SU2fund{T})
|
||||||
|
|
||||||
|
Returns the norm of a fundamental element. Same result as sqrt(dot(a,a)).
|
||||||
|
"""
|
||||||
|
norm2(a::SU2fund{T}) where T <: AbstractFloat = (abs2(a.t1) + abs2(a.t2))
|
||||||
|
|
||||||
|
"""
|
||||||
|
dot(a::SU2fund{T},b::SU2fund{T})
|
||||||
|
|
||||||
|
Returns the scalar product of two fundamental elements. The convention is for the product to the linear in the second argument, and anti-linear in the first argument.
|
||||||
|
"""
|
||||||
|
dot(g1::SU2fund{T},g2::SU2fund{T}) where T <: AbstractFloat = conj(g1.t1)*g2.t1+conj(g1.t2)*g2.t2
|
||||||
|
|
||||||
|
"""
|
||||||
|
*(g::SU2{T},b::SU2fund{T})
|
||||||
|
|
||||||
|
Returns ga
|
||||||
|
"""
|
||||||
|
Base.:*(g::SU2{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(g.t1*b.t1 + g.t2*b.t2,-conj(g.t2)*b.t1 + conj(g.t1)*b.t2)
|
||||||
|
|
||||||
|
"""
|
||||||
|
\\(g::SU2{T},b::SU2fund{T})
|
||||||
|
|
||||||
|
Returns g^dag b
|
||||||
|
"""
|
||||||
|
Base.:\(g::SU2{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(conj(g.t1)*b.t1 - g.t2 * b.t2,conj(g.t2)*b.t1 + g.t1 * b.t2)
|
||||||
|
|
||||||
|
"""
|
||||||
|
*(a::SU2alg{T},b::SU2fund{T})
|
||||||
|
|
||||||
|
Returns a*b
|
||||||
|
"""
|
||||||
|
|
||||||
|
Base.:*(a::SU2alg{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(complex(0.0, a.t3)*b.t1/2 + complex(a.t2,a.t1)*b.t2/2,
|
||||||
|
complex(-a.t2,a.t1)*b.t1/2 + complex(0.0, -a.t3)*b.t1/2)
|
||||||
|
|
||||||
|
Base.:+(a::SU2fund{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(a.t1+b.t1,a.t2+b.t2)
|
||||||
|
Base.:-(a::SU2fund{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(a.t1-b.t1,a.t2-b.t2)
|
||||||
|
Base.:+(a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(a.t1,a.t2)
|
||||||
|
Base.:-(a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(-a.t1,-a.t2)
|
||||||
|
imm(a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(complex(-imag(a.t1),real(a.t1)),
|
||||||
|
complex(-imag(a.t2),real(a.t2)))
|
||||||
|
mimm(a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(complex(imag(a.t1),-real(a.t1)),
|
||||||
|
complex(imag(a.t2),-real(a.t2)))
|
||||||
|
|
||||||
|
# Operations with numbers
|
||||||
|
Base.:*(a::SU2fund{T},b::Number) where T <: AbstractFloat = SU2fund{T}(b*a.t1,b*a.t2)
|
||||||
|
Base.:*(b::Number,a::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(b*a.t1,b*a.t2)
|
||||||
|
Base.:/(a::SU2fund{T},b::Number) where T <: AbstractFloat = SU2fund{T}(a.t1/b,a.t2/b)
|
||||||
|
|
||||||
|
Base.:*(a::M2x2{T},b::SU2fund{T}) where T <: AbstractFloat = SU2fund{T}(a.u11*b.t1 + a.u12*b.t2,
|
||||||
|
a.u21*b.t1 + a.u22*b.t2)
|
|
@ -54,11 +54,12 @@ export Group, Algebra, GMatrix
|
||||||
# SU(2) and 2x2 matrix operations
|
# SU(2) and 2x2 matrix operations
|
||||||
##
|
##
|
||||||
include("SU2Types.jl")
|
include("SU2Types.jl")
|
||||||
export SU2, SU2alg, M2x2
|
export SU2, SU2alg, M2x2, SU2fund
|
||||||
|
|
||||||
include("GroupSU2.jl")
|
include("GroupSU2.jl")
|
||||||
include("M2x2.jl")
|
include("M2x2.jl")
|
||||||
include("AlgebraSU2.jl")
|
include("AlgebraSU2.jl")
|
||||||
|
include("FundamentalSU2.jl")
|
||||||
## END SU(2)
|
## END SU(2)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -74,8 +75,10 @@ include("FundamentalSU3.jl")
|
||||||
export imm, mimm
|
export imm, mimm
|
||||||
## END SU(3)
|
## END SU(3)
|
||||||
|
|
||||||
|
|
||||||
|
include("AlgebraU2.jl")
|
||||||
include("AlgebraU3.jl")
|
include("AlgebraU3.jl")
|
||||||
export U3alg
|
export U2alg, U3alg
|
||||||
|
|
||||||
include("GroupU1.jl")
|
include("GroupU1.jl")
|
||||||
export U1, U1alg
|
export U1, U1alg
|
||||||
|
|
|
@ -53,3 +53,13 @@ Base.convert(::Type{M2x2{T}}, a::SU2{T}) where T = M2x2{T}(a.t1,a.t2,-conj(a.t2)
|
||||||
|
|
||||||
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2alg{T}}) where T <: AbstractFloat = SU2alg{T}(randn(rng,T),randn(rng,T),randn(rng,T))
|
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2alg{T}}) where T <: AbstractFloat = SU2alg{T}(randn(rng,T),randn(rng,T),randn(rng,T))
|
||||||
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2{T}}) where T <: AbstractFloat = exp(SU2alg{T}(randn(rng,T),randn(rng,T),randn(rng,T)))
|
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2{T}}) where T <: AbstractFloat = exp(SU2alg{T}(randn(rng,T),randn(rng,T),randn(rng,T)))
|
||||||
|
|
||||||
|
|
||||||
|
struct SU2fund{T}
|
||||||
|
t1::Complex{T}
|
||||||
|
t2::Complex{T}
|
||||||
|
end
|
||||||
|
|
||||||
|
Base.zero(::Type{SU2fund{T}}) where T <: AbstractFloat = SU2fund{T}(zero(T),zero(T),zero(T))
|
||||||
|
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU2fund{T}}) where T <: AbstractFloat = SU2fund{T}(complex(randn(rng,T),randn(rng,T)),
|
||||||
|
complex(randn(rng,T),randn(rng,T)))
|
|
@ -16,7 +16,7 @@ include("Groups/Groups.jl")
|
||||||
|
|
||||||
using .Groups
|
using .Groups
|
||||||
export Group, Algebra, GMatrix
|
export Group, Algebra, GMatrix
|
||||||
export SU2, SU2alg, SU3, SU3alg, M3x3, M2x2, U1, U1alg, SU3fund, U3alg
|
export SU2, SU2alg, SU3, SU3alg, M3x3, M2x2, U1, U1alg, SU3fund, U3alg, SU2fund, U2alg
|
||||||
export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one, antsym
|
export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one, antsym
|
||||||
|
|
||||||
include("Space/Space.jl")
|
include("Space/Space.jl")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue