mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 11:13:42 +02:00
Master
This commit is contained in:
parent
d16c9ad341
commit
9d06f777a0
9 changed files with 135 additions and 14 deletions
|
@ -54,15 +54,31 @@ struct DiracWorkspace{T}
|
|||
|
||||
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)
|
||||
sp = scalar_field(Spinor{4,G}, lp)
|
||||
sAp = scalar_field(Spinor{4,G}, lp)
|
||||
st = scalar_field(Spinor{4,G}, lp)
|
||||
@timeit "Allocating DiracWorkspace" begin
|
||||
if G == SU3fund
|
||||
sr = scalar_field(Spinor{4,SU3fund{T}}, lp)
|
||||
sp = scalar_field(Spinor{4,SU3fund{T}}, lp)
|
||||
sAp = scalar_field(Spinor{4,SU3fund{T}}, lp)
|
||||
st = scalar_field(Spinor{4,SU3fund{T}}, lp)
|
||||
csw = tensor_field(U3alg{T},lp)
|
||||
elseif G == SU2fund
|
||||
sr = scalar_field(Spinor{4,SU2fund{T}}, lp)
|
||||
sp = scalar_field(Spinor{4,SU2fund{T}}, lp)
|
||||
sAp = scalar_field(Spinor{4,SU2fund{T}}, lp)
|
||||
st = scalar_field(Spinor{4,SU2fund{T}}, lp)
|
||||
csw = tensor_field(U2alg{T},lp)
|
||||
else
|
||||
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 = nothing
|
||||
end
|
||||
end
|
||||
|
||||
csw = tensor_field(U3alg{T},lp)
|
||||
return new{T}(sr,sp,sAp,st,csw)
|
||||
end
|
||||
|
||||
return new{T}(sr,sp,sAp,st,csw,cs)
|
||||
end
|
||||
end
|
||||
|
||||
export DiracWorkspace, DiracParam
|
||||
|
|
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)
|
||||
|
72
src/Groups/FundamentalSU2.jl
Normal file
72
src/Groups/FundamentalSU2.jl
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
|
||||
|
||||
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
|
||||
##
|
||||
include("SU2Types.jl")
|
||||
export SU2, SU2alg, M2x2
|
||||
export SU2, SU2alg, M2x2, SU2fund
|
||||
|
||||
include("GroupSU2.jl")
|
||||
include("M2x2.jl")
|
||||
include("AlgebraSU2.jl")
|
||||
include("FundamentalSU2.jl")
|
||||
## END SU(2)
|
||||
|
||||
##
|
||||
|
@ -74,8 +75,10 @@ include("FundamentalSU3.jl")
|
|||
export imm, mimm
|
||||
## END SU(3)
|
||||
|
||||
|
||||
include("AlgebraU2.jl")
|
||||
include("AlgebraU3.jl")
|
||||
export U3alg
|
||||
export U2alg, U3alg
|
||||
|
||||
include("GroupU1.jl")
|
||||
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{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
|
||||
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
|
||||
|
||||
include("Space/Space.jl")
|
||||
|
|
|
@ -14,7 +14,7 @@ lp = SpaceParm{4}(size,(4,4,4,4),1,(0,0,0,0,0,0));
|
|||
exptheta = exp.(im.*theta./lp.iL);
|
||||
|
||||
dpar = DiracParam{Float64}(SU3fund,m,0.0,exptheta,1.0);
|
||||
dws = DiracWorkspace(SU3fund{Float64},Float64,lp);
|
||||
dws = DiracWorkspace(SU3fund,Float64,lp);
|
||||
|
||||
U = fill!(vector_field(SU3{Float64},lp),one(SU3{Float64}));
|
||||
psi = scalar_field(Spinor{4,SU3fund{Float64}},lp);
|
||||
|
@ -66,7 +66,7 @@ function fA_test(;theta = (0.5,0.7,1.0,0.0), m = 1.3, size = (8,8,8,16),prec = 1
|
|||
exptheta = exp.(im.*theta./lp.iL);
|
||||
|
||||
dpar = DiracParam{Float64}(SU3fund,m,0.0,exptheta,1.0);
|
||||
dws = DiracWorkspace(SU3fund{Float64},Float64,lp);
|
||||
dws = DiracWorkspace(SU3fund,Float64,lp);
|
||||
|
||||
U = fill!(vector_field(SU3{Float64},lp),one(SU3{Float64}));
|
||||
psi = scalar_field(Spinor{4,SU3fund{Float64}},lp);
|
||||
|
|
|
@ -8,7 +8,7 @@ function Dwpw_test(;p=0,s=1,c=1)
|
|||
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4), 0, (0,0,0,0,0,0))
|
||||
gp = GaugeParm{Float64}(SU3{Float64}, 6.0, 1.0)
|
||||
dpar = DiracParam{Float64}(SU3fund,1.3,0.0,(1.0,1.0,1.0,1.0),0.0)
|
||||
dws = DiracWorkspace(SU3fund{Float64},Float64,lp);
|
||||
dws = DiracWorkspace(SU3fund,Float64,lp);
|
||||
|
||||
p==0 ? p = Int.(round.(lp.iL.*rand(4),RoundUp)) : nothing
|
||||
U = fill!(vector_field(SU3{Float64},lp),one(SU3{Float64}))
|
||||
|
|
|
@ -10,7 +10,7 @@ using CUDA, LatticeGPU, TimerOutputs
|
|||
gp = GaugeParm{Float64}(SU3{Float64}, 6.0, 1.0)
|
||||
ymws = YMworkspace(SU3, Float64, lp)
|
||||
dpar = DiracParam{Float64}(SU3fund,2.3,0.0,(1.0,1.0,1.0,1.0),0.0)
|
||||
dws = DiracWorkspace(SU3fund{Float64},Float64,lp);
|
||||
dws = DiracWorkspace(SU3fund,Float64,lp);
|
||||
|
||||
randomize!(ymws.mom, lp, ymws)
|
||||
U = exp.(ymws.mom)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue