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)))