Skip to content

Commit

Permalink
Enable eigenvalue measurement for even-odd staggered (DdaggerD only)
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaFuwa committed Jun 7, 2024
1 parent 7b4ef8b commit 4adb837
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/diracoperators/DiracOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,37 @@ end

function construct_diracmatrix(D, U)
n = checksquare(D)
Du = D(U)
Du = DdaggerD(D(U))
M = spzeros(ComplexF64, n, n)
temp1 = similar(get_temp(D))
temp2 = similar(get_temp(D))
ND = num_dirac(temp1)
fdims = dims(U)
NV = U.NV
@assert n < 5000
is_evenodd = temp1 isa EvenOdd

ii = 1
for isite in eachindex(U)
if is_evenodd
iseven(isite) || continue
end
for α in 1:ND
for a in 1:3
set_source!(temp1, isite, a, α)
mul!(temp2, Du, temp1)
jj = 1
for jsite in eachindex(U)
if is_evenodd
iseven(jsite) || continue
_jsite = eo_site(jsite, fdims..., NV)
else
_jsite = jsite
end
for β in 1:ND
for b in 1:3
ind =- 1) * 3 + b
M[jj, ii] = temp2[jsite][ind]
M[jj, ii] = temp2[_jsite][ind]
jj += 1
end
end
Expand Down
13 changes: 12 additions & 1 deletion src/gaugefields/fermionfields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,21 @@ end
Base.size(f::EvenOdd) = size(f.parent)
Base.similar(f::EvenOdd) = even_odd(Fermionfield(f.parent))
Base.eltype(::EvenOdd{B,T}) where {B,T} = Complex{T}
LinearAlgebra.checksquare(f::EvenOdd) = LinearAlgebra.checksquare(f.parent)
LinearAlgebra.checksquare(f::EvenOdd) = LinearAlgebra.checksquare(f.parent) ÷ 2
num_colors(::EvenOdd{B,T,A,ND}) where {B,T,A,ND} = 3
num_dirac(::EvenOdd{B,T,A,ND}) where {B,T,A,ND} = ND

Base.@propagate_inbounds Base.getindex(f::EvenOdd, i::Integer) = f.parent.U[i]
Base.@propagate_inbounds Base.getindex(f::EvenOdd, x, y, z, t) = f.parent.U[x, y, z, t]
Base.@propagate_inbounds Base.getindex(f::EvenOdd, site::SiteCoords) = f.parent.U[site]
Base.@propagate_inbounds Base.setindex!(f::EvenOdd, v, i::Integer) =
setindex!(f.parent.U, v, i)
Base.@propagate_inbounds Base.setindex!(f::EvenOdd, v, x, y, z, t) =
setindex!(f.parent.U, v, x, y, z, t)
Base.@propagate_inbounds Base.setindex!(f::EvenOdd, v, site::SiteCoords) =
setindex!(f.parent.U, v, site)


clear!(ϕ_eo::EvenOdd) = clear!(ϕ_eo.parent)
ones!(ϕ_eo::EvenOdd) = ones!(ϕ_eo.parent)

Expand Down
2 changes: 2 additions & 0 deletions src/measurements/measure_eigenvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ struct EigenvaluesMeasurement{T,TA,TD} <: AbstractMeasurement
dirac_operator = StaggeredEOPreDiracOperator(
U, mass; anti_periodic=anti_periodic
)
@level1("@Warn Eigenvalues with \"eo_precon=true\" defaults to DdaggerD")
ddaggerd = true
else
dirac_operator = StaggeredDiracOperator(
U, mass; anti_periodic=anti_periodic
Expand Down

0 comments on commit 4adb837

Please sign in to comment.