Added U3alg for Fmunu

parent 09033f79
...@@ -59,7 +59,7 @@ struct DiracWorkspace{T} ...@@ -59,7 +59,7 @@ struct DiracWorkspace{T}
sAp = scalar_field(Spinor{4,G}, lp) sAp = scalar_field(Spinor{4,G}, lp)
st = scalar_field(Spinor{4,G}, lp) st = scalar_field(Spinor{4,G}, lp)
csw = tensor_field(M3x3{T},lp) csw = tensor_field(U3alg{T},lp)
return new{T}(sr,sp,sAp,st,csw) return new{T}(sr,sp,sAp,st,csw)
end end
end end
...@@ -244,6 +244,7 @@ function clover(g1::SU3{T},g2::SU3{T},g3::SU3{T},g4::SU3{T}) where {T} ...@@ -244,6 +244,7 @@ function clover(g1::SU3{T},g2::SU3{T},g3::SU3{T},g4::SU3{T}) where {T}
u31 = conj(g1.u12*g1.u23 - g1.u13*g1.u22) + conj(g2.u12*g2.u23 - g2.u13*g2.u22) + conj(g3.u12*g3.u23 - g3.u13*g3.u22) + conj(g4.u12*g4.u23 - g4.u13*g4.u22) u31 = conj(g1.u12*g1.u23 - g1.u13*g1.u22) + conj(g2.u12*g2.u23 - g2.u13*g2.u22) + conj(g3.u12*g3.u23 - g3.u13*g3.u22) + conj(g4.u12*g4.u23 - g4.u13*g4.u22)
u32 = conj(g1.u13*g1.u21 - g1.u11*g1.u23) + conj(g2.u13*g2.u21 - g2.u11*g2.u23) + conj(g3.u13*g3.u21 - g3.u11*g3.u23) + conj(g4.u13*g4.u21 - g4.u11*g4.u23) u32 = conj(g1.u13*g1.u21 - g1.u11*g1.u23) + conj(g2.u13*g2.u21 - g2.u11*g2.u23) + conj(g3.u13*g3.u21 - g3.u11*g3.u23) + conj(g4.u13*g4.u21 - g4.u11*g4.u23)
u33 = conj(g1.u11*g1.u22 - g1.u12*g1.u21) + conj(g2.u11*g2.u22 - g2.u12*g2.u21) + conj(g3.u11*g3.u22 - g3.u12*g3.u21) + conj(g4.u11*g4.u22 - g4.u12*g4.u21) u33 = conj(g1.u11*g1.u22 - g1.u12*g1.u21) + conj(g2.u11*g2.u22 - g2.u12*g2.u21) + conj(g3.u11*g3.u22 - g3.u12*g3.u21) + conj(g4.u11*g4.u22 - g4.u12*g4.u21)
return -0.125*im*M3x3{T}(u11-conj(u11),u12-conj(u21),u13-conj(u31),u21-conj(u12),u22-conj(u22),u23-conj(u32),u31-conj(u13),u32-conj(u23),u33-conj(u33)) return -0.125*im*M3x3{T}(u11-conj(u11),u12-conj(u21),u13-conj(u31),u21-conj(u12),u22-conj(u22),u23-conj(u32),u31-conj(u13),u32-conj(u23),u33-conj(u33))
end end
...@@ -397,9 +398,9 @@ function krnl_csw!(csw::AbstractArray{T}, U, Ubnd, ipl, ztw, lp::SpaceParm{4,M,B ...@@ -397,9 +398,9 @@ function krnl_csw!(csw::AbstractArray{T}, U, Ubnd, ipl, ztw, lp::SpaceParm{4,M,B
if !(SFBC && (it == 1)) if !(SFBC && (it == 1))
if TWP if TWP
csw[b,ipl,r] = ztw*clover(M1,M2,M3,M4) csw[b,ipl,r] = ztw*(antsym(M1)+antsym(M2)+antsym(M3)+antsym(M4))
else else
csw[b,ipl,r] = clover(M1,M2,M3,M4) csw[b,ipl,r] = antsym(M1)+antsym(M2)+antsym(M3)+antsym(M4)
end end
end end
......
struct U3alg{T} <: Algebra
u11::T
u22::T
u33::T
u12::Complex{T}
u13::Complex{T}
u23::Complex{T}
end
function antsym(a::SU3{T}) where T <: AbstractFloat
t1 = 2.0*imag(a.u11)
t2 = 2.0*imag(a.u22)
t3 = 2.0*imag(a.u12*a.u21 - a.u11*a.u22)
return U3alg{T}(t1,t2,t3,a.u12,a.u13,a.u23)
end
Base.:*(a::U3alg{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(a.u11*b.t1 + a.u12*b.t2 + a.u13*b.t3,
-a.u12*b.t1 + a.u22*b.t2 + a.u23*b.t3,
-a.u13*b.t1 - a.u23*b.t2 + a.u33*b.t3)
Base.:+(a::U3alg{T},b::U3alg{T}) where T <: AbstractFloat = U3alg{T}(a.u11 + b.u11, a.u22 + b.u22, a.u33 + b.u33, a.u12 + b.u12, a.u13 + b.u13, a.u23 + b.u23)
Base.:*(r::Number, a::U3alg{T}) where T <: AbstractFloat = U3alg{T}(r*a.u11, r*a.u22, r*a.u33, r*a.u12, r*a.u13, r*a.u23)
...@@ -65,7 +65,7 @@ include("AlgebraSU2.jl") ...@@ -65,7 +65,7 @@ include("AlgebraSU2.jl")
# SU(3) and 3x3 matrix operations # SU(3) and 3x3 matrix operations
## ##
include("SU3Types.jl") include("SU3Types.jl")
export SU3, SU3alg, M3x3, SU3fund export SU3, SU3alg, M3x3, SU3fund, U3alg
include("GroupSU3.jl") include("GroupSU3.jl")
include("M3x3.jl") include("M3x3.jl")
...@@ -78,7 +78,7 @@ include("GroupU1.jl") ...@@ -78,7 +78,7 @@ include("GroupU1.jl")
export U1, U1alg export U1, U1alg
export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one, antsym
end # module end # module
...@@ -16,8 +16,8 @@ include("Groups/Groups.jl") ...@@ -16,8 +16,8 @@ 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 export SU2, SU2alg, SU3, SU3alg, M3x3, M2x2, U1, U1alg, SU3fund, U3alg
export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one export dot, expm, exp, dag, unitarize, inverse, tr, projalg, norm, norm2, isgroup, alg2mat, dev_one, antsym
include("Space/Space.jl") include("Space/Space.jl")
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
""" """
function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, y::NTuple{4,Int64}, c::Int64, s::Int64) function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, y::NTuple{4,Int64}, c::Int64, s::Int64)
Returns the fermionic progapator for a source at point `y` with color `c` and spin `s`. If the last three arguments are replaced by `time::Int64`, the source is replaced Returns the fermionic progapator for a source at point `y` with color `c` and spin `s`. If the last three arguments are replaced by `time::Int64`, the source is replaced
by a random source in spin and color at t = `time`. by a random source in spin and color at t = `time`.
""" """
function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, y::NTuple{4,Int64}, c::Int64, s::Int64) where {T} function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, y::NTuple{4,Int64}, c::Int64, s::Int64) where {T}
function krnlg5!(src) function krnlg5!(src)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -25,14 +25,14 @@ function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspa ...@@ -25,14 +25,14 @@ function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspa
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src)
end end
g5Dw!(pro,U,src,dpar,lp,ymws) g5Dw!(pro,U,src,dpar,lp)
CG!(pro,U,DwdagDw!,dpar,lp,dws,ymws,maxiter,tol) CG!(pro,U,DwdagDw!,dpar,lp,dws,maxiter,tol)
return pro return pro
end end
function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace,ymws::YMworkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, time::Int64) where {T} function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::SpaceParm, maxiter::Int64, tol::Float64, time::Int64) where {T}
function krnlg5!(src) function krnlg5!(src)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -49,25 +49,25 @@ function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace,ymws::YMworkspac ...@@ -49,25 +49,25 @@ function propagator(U, dpar::DiracParam{T}, dws::DiracWorkspace,ymws::YMworkspac
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src)
end end
g5Dw!(pro,U,src,dpar,lp,ymws) g5Dw!(pro,U,src,dpar,lp)
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src)
end end
CG!(pro,U,DwdagDw!,dpar,lp,dws,ymws,maxiter,tol) CG!(pro,U,DwdagDw!,dpar,lp,dws,maxiter,tol)
return pro return pro
end end
""" """
function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspace, lp::SpaceParm{4,6,1,D}, maxiter::Int64, tol::Float64, c::Int64, s::Int64) function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::SpaceParm{4,6,1,D}, maxiter::Int64, tol::Float64, c::Int64, s::Int64)
Returns the propagator from the t=0 boundary to the bulk for the SF boundary conditions for a source with color 'c' and spin 's'. Returns the propagator from the t=0 boundary to the bulk for the SF boundary conditions for a source with color 'c' and spin 's'.
""" """
function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMworkspace, lp::SpaceParm{4,6,1,D}, maxiter::Int64, tol::Float64, c::Int64, s::Int64) where {T,D} function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::SpaceParm{4,6,1,D}, maxiter::Int64, tol::Float64, c::Int64, s::Int64) where {T,D}
function krnlg5!(src) function krnlg5!(src)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -99,9 +99,9 @@ function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMwork ...@@ -99,9 +99,9 @@ function bndpropagator(U, dpar::DiracParam{T}, dws::DiracWorkspace, ymws::YMwork
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnlg5!(src)
end end
g5Dw!(pro,U,src,dpar,lp,ymws) g5Dw!(pro,U,src,dpar,lp)
CG!(pro,U,DwdagDw!,dpar,lp,dws,ymws,maxiter,tol) CG!(pro,U,DwdagDw!,dpar,lp,dws,maxiter,tol)
return pro return pro
end end
...@@ -56,31 +56,6 @@ Returns the scalar product of two spinors. ...@@ -56,31 +56,6 @@ Returns the scalar product of two spinors.
return :($sum) return :($sum)
end end
#=
"""
Diracdot(a::Spinor,b::Spinor)
Returns the scalar product of the dirac adjoint of the first spinor times the second spinor.
"""
function Diracdot(a::Spinor{NS,G},b::Spinor{NS,G}) where {NS,G}
S = dot(dag(a).s[3], b[1]) + dot(dag(a).s[4], b[2])
+ dot(dag(a).s[1], b[3]) + dot(dag(a).s[2], b[4])
return -S
end
#"""
# dag(a::Spinor)
#Returns a^+
#"""
#function dag(a::Spinor{NS,G}) where {NS,G}
# return Spinor{NS,G}(ntuple(i -> dag(a.s[i]),Val(NS))) # Need dag function for G, export it from SU3fund.jl
#end
=#
""" """
*(g::SU3{T},b::Spinor) *(g::SU3{T},b::Spinor)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment