mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-15 03:33:42 +02:00
Addition of conversion group,algebra to generit matrices for SU(3)
This commit is contained in:
parent
a5e7cfd8b0
commit
afd837e80d
9 changed files with 19 additions and 305 deletions
|
@ -59,6 +59,8 @@ Base.:*(a::SU3alg{T},b::Number) where T <: AbstractFloat = SU3alg{T}(b*a.t1,b
|
|||
Base.:*(b::Number,a::SU3alg{T}) where T <: AbstractFloat = SU3alg{T}(b*a.t1,b*a.t2,b*a.t3,b*a.t4,b*a.t5,b*a.t6,b*a.t7,b*a.t8)
|
||||
Base.:/(a::SU3alg{T},b::Number) where T <: AbstractFloat = SU3alg{T}(a.t1/b,a.t2/b,a.t3/b,a.t4/b,a.t5/b,a.t6/b,a.t7/b,a.t8/b)
|
||||
|
||||
Base.:*(a::SU3alg{T},b::SU3alg{T}) where T = convert(M3x3{T}, a)*convert(M3x3{T}, a)
|
||||
|
||||
|
||||
function alg2mat(a::SU3alg{T}) where T <: AbstractFloat
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ function Base.:/(a::M3x3{T},b::SU3{T}) where T <: AbstractFloat
|
|||
a.u31*conj(b.u21) + a.u32*conj(b.u22) + a.u33*conj(b.u23),
|
||||
a.u31*(bu31) + a.u32*(bu32) + a.u33*(bu33))
|
||||
end
|
||||
Base.:/(a::M3x3{T}, b::Number) where T <: AbstractFloat = M3x3{T}(a.u11/b, a.u12/b, a.u13/b,
|
||||
a.u21/b, a.u22/b, a.u23/b,
|
||||
a.u31/b, a.u32/b, a.u33/b)
|
||||
|
||||
function Base.:\(a::SU3{T},b::M3x3{T}) where T <: AbstractFloat
|
||||
|
||||
|
@ -131,3 +134,4 @@ end
|
|||
dag(a::M3x3{T}) where T = M3x3{T}(conj(a.u11), conj(a.u21), conj(a.u31),
|
||||
conj(a.u12), conj(a.u22), conj(a.u32),
|
||||
conj(a.u13), conj(a.u23), conj(a.u33))
|
||||
tr(a::M3x3{T}) where T = a.u11+a.u22+a.u33
|
||||
|
|
|
@ -32,5 +32,8 @@ Base.zero(::Type{M2x2{T}}) where T <: AbstractFloat = M2x2{T}(zero(T),zero(T),
|
|||
Base.one(::Type{SU2{T}}) where T <: AbstractFloat = SU2{T}(one(T),zero(T))
|
||||
Base.one(::Type{M2x2{T}}) where T <: AbstractFloat = M2x2{T}(one(T),zero(T),zero(T),one(T))
|
||||
|
||||
Base.convert(::Type{M2x2{T}}, a::SU3alg{T}) where T = alg2mat(a)
|
||||
Base.convert(::Type{M2x2{T}}, a::SU3{T}) where T = M2x2{T}(a.t1,a.t2,-conj(a.t2), conj(a.t1))
|
||||
|
||||
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)))
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
# a.u33 = conj(a.u11*a.u22 - a.u12*a.u21)
|
||||
#
|
||||
|
||||
import Base.convert
|
||||
|
||||
struct SU3{T} <: Group
|
||||
u11::Complex{T}
|
||||
u12::Complex{T}
|
||||
|
@ -57,6 +59,12 @@ end
|
|||
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU3{T}}) where T <: AbstractFloat = exp(SU3alg{T}(randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T)))
|
||||
Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU3alg{T}}) where T <: AbstractFloat = SU3alg{T}(randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T),randn(rng,T))
|
||||
|
||||
Base.convert(::Type{M3x3{T}}, a::SU3alg{T}) where T = alg2mat(a)
|
||||
Base.convert(::Type{M3x3{T}}, a::SU3{T}) where T = M3x3{T}(a.u11,a.u12,a.u13,
|
||||
a.u21,a.u22,a.u23,
|
||||
conj(a.u12*a.u23 - a.u13*a.u22),
|
||||
conj(a.u13*a.u21 - a.u11*a.u23),
|
||||
conj(a.u11*a.u22 - a.u12*a.u21))
|
||||
struct SU3fund{T}
|
||||
t1::Complex{T}
|
||||
t2::Complex{T}
|
||||
|
@ -67,3 +75,4 @@ Random.rand(rng::AbstractRNG, ::Random.SamplerType{SU3fund{T}}) where T <: Abstr
|
|||
complex(randn(rng,T),randn(rng,T)),
|
||||
complex(randn(rng,T),randn(rng,T)))
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
module Spinors
|
||||
|
||||
using ..Groups
|
||||
import ..Groups.imm, ..Groups.mimm, ..Groups.norm, ..Groups.norm2
|
||||
import ..Groups.imm, ..Groups.mimm, ..Groups.norm, ..Groups.norm2, ..Groups.dot
|
||||
|
||||
struct Spinor{NS,G}
|
||||
s::NTuple{NS,G}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue