Several bugs corrected

This commit is contained in:
Alberto Ramos 2021-11-18 13:59:06 +01:00
parent cbdd0ec8fb
commit 7766517358
5 changed files with 20 additions and 11 deletions

View file

@ -52,13 +52,13 @@ Base.:*(g::SU3{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(g.u11
conj(g.u11*g.u22 - g.u12*g.u21)*b.t3)
"""
\(g::SU3{T},b::SU3fund{T})
\\(g::SU3{T},b::SU3fund{T})
Returns g^dag b
"""
Base.:\(a::SU3{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(conj(g.u11)*b.t1 + conj(g.u21)*b.t2 + (a.u12*a.u23 - a.u13*a.u22)*b.t3,
conj(g.u12)*b.t1 + conj(g.u22)*b.t2 + (a.u13*a.u21 - a.u11*a.u23)*b.t3,
conj(g.u13)*b.t1 + conj(g.u23)*b.t2 + (a.u11*a.u22 - a.u12*a.u21)*b.t3)
Base.:\(g::SU3{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(conj(g.u11)*b.t1 + conj(g.u21)*b.t2 + (g.u12*g.u23 - g.u13*g.u22)*b.t3,
conj(g.u12)*b.t1 + conj(g.u22)*b.t2 + (g.u13*g.u21 - g.u11*g.u23)*b.t3,
conj(g.u13)*b.t1 + conj(g.u23)*b.t2 + (g.u11*g.u22 - g.u12*g.u21)*b.t3)
Base.:+(a::SU3fund{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(a.t1+b.t1,a.t2+b.t2,a.t3+b.t3)
Base.:-(a::SU3fund{T},b::SU3fund{T}) where T <: AbstractFloat = SU3fund{T}(a.t1-b.t1,a.t2-b.t2,a.t3-b.t3)

View file

@ -36,7 +36,7 @@ include("AlgebraSU2.jl")
# SU(3) and 3x3 matrix operations
##
include("SU3Types.jl")
export SU3, SU3alg, M3x3
export SU3, SU3alg, M3x3, SU3fund
include("GroupSU3.jl")
include("M3x3.jl")

View file

@ -63,4 +63,7 @@ struct SU3fund{T}
t3::Complex{T}
end
Base.zero(::Type{SU3fund{T}}) where T <: AbstractFloat = SU3fund{T}(zero(T),zero(T),zero(T))
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU3fund{T}}) where T <: AbstractFloat = SU3fund{T}(complex(randn(rng,T),randn(rng,T)),
complex(randn(rng,T),randn(rng,T)),
complex(randn(rng,T),randn(rng,T)))

View file

@ -47,10 +47,10 @@ export flw, flw_adapt
export sfcoupling, bndfield, setbndfield
export import_lex64, import_cern64
include("Spinors/Spinor.jl")
include("Spinors/Spinors.jl")
using .Spinors
export Pgamma
export Spinor, Pgamma
export norm, norm2, dot, imm, mimm
export pmul, gpmul, gdagpmul

View file

@ -64,7 +64,7 @@ Returns ga
Base.:*(g::S,b::Spinor{NS,G}) where {S <: Group,NS,G} = Spinor{NS,G}(ntuple(i->g*b.s[i], NS))
"""
\(g::SU3{T},b::Spinor{NS,G})
\\(g::SU3{T},b::Spinor{NS,G})
Returns g^+ a
"""
@ -97,7 +97,7 @@ end
"""
pmul(Pgamma{N,S}, a::Spinor)
Returns (1+s\gamma_N)a.
Returns ``(1+s\\gamma_N)a``.
"""
function pmul(::Type{Pgamma{4,1}}, a::Spinor{4,G}) where {NS,G}
@ -155,7 +155,7 @@ end
"""
gpmul(pgamma{N,S}, g::G, a::Spinor) G <: Group
Returns g(1+s\gamma_N)a
Returns ``g(1+s\\gamma_N)a``
"""
function gpmul(::Type{Pgamma{4,1}}, g, a::Spinor{4,G}) where {NS,G}
@ -212,7 +212,7 @@ end
"""
gdagpmul(pgamma{N,S}, g::G, a::Spinor) G <: Group
Returns g^+ (1+s\gamma_N)a
Returns ``g^+ (1+s\\gamma_N)a``
"""
function gdagpmul(::Type{Pgamma{4,1}}, g, a::Spinor{4,G}) where {NS,G}
@ -265,3 +265,9 @@ function gdagpmul(::Type{Pgamma{3,-1}}, g, a::Spinor{4,G}) where {NS,G}
r2 = g\(a.s[2]+imm(a.s[4]))
return Spinor{4,G}((r1,r2,imm(r1),mimm(r2)))
end
export Spinor, Pgamma
export norm, norm2, dot, imm, mimm
export pmul, gpmul, gdagpmul
end