-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overlap now works well (adjusted maxevals)
- Loading branch information
1 parent
20aac41
commit ac221e3
Showing
11 changed files
with
298 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
using Test | ||
using SparseIR | ||
|
||
const ε = (@isdefined Double64) ? nothing : 1e-15 | ||
|
||
@testset "matsubara.jl" begin | ||
@testset "single pole" begin | ||
for stat in (fermion, boson), Λ in (1e1, 1e4) | ||
wmax = 1.0 | ||
pole = 0.1 * wmax | ||
β = Λ / wmax | ||
basis = FiniteTempBasis(stat, β, wmax, ε; sve_result=sve_logistic[Λ]) | ||
@testset "single pole with stat = $stat, Λ = $Λ" for stat in (fermion, boson), | ||
Λ in (1e1, 1e4) | ||
|
||
ε = (@isdefined Double64) ? nothing : 1e-15 | ||
wmax = 1.0 | ||
pole = 0.1 * wmax | ||
β = Λ / wmax | ||
basis = FiniteTempBasis(stat, β, wmax, ε; sve_result=sve_logistic[Λ]) | ||
|
||
stat_shift = (stat == fermion) ? 1 : 0 | ||
weight = (stat == fermion) ? 1 : 1 / tanh(0.5 * Λ * pole / wmax) | ||
gl = -basis.s .* basis.v(pole) * weight | ||
stat_shift = (stat == fermion) ? 1 : 0 | ||
weight = (stat == fermion) ? 1 : 1 / tanh(0.5 * Λ * pole / wmax) | ||
gl = -basis.s .* basis.v(pole) * weight | ||
|
||
func_G(n) = 1 / (im * (2n + stat_shift) * π / β - pole) | ||
func_G(n) = 1 / (im * (2n + stat_shift) * π / β - pole) | ||
|
||
# Compute G(iwn) using unl | ||
matsu_test = Int[-1, 0, 1, 1e2, 1e4, 1e6, 1e8, 1e10, 1e12] | ||
prj_w = transpose(basis.uhat(2matsu_test .+ stat_shift)) | ||
Giwn_t = prj_w * gl | ||
# Compute G(iwn) using unl | ||
matsu_test = Int[-1, 0, 1, 1e2, 1e4, 1e6, 1e8, 1e10, 1e12] | ||
prj_w = transpose(basis.uhat(2matsu_test .+ stat_shift)) | ||
Giwn_t = prj_w * gl | ||
|
||
# Compute G(iwn) from analytic expression | ||
Giwn_ref = func_G.(matsu_test) | ||
# Compute G(iwn) from analytic expression | ||
Giwn_ref = func_G.(matsu_test) | ||
|
||
magnitude = maximum(abs, Giwn_ref) | ||
diff = abs.(Giwn_t - Giwn_ref) | ||
tol = max(10 * last(basis.s) / first(basis.s), 1e-10) | ||
magnitude = maximum(abs, Giwn_ref) | ||
diff = abs.(Giwn_t - Giwn_ref) | ||
tol = max(10 * last(basis.s) / first(basis.s), 1e-10) | ||
|
||
# Absolute error | ||
@test maximum(diff ./ magnitude) < tol | ||
# Absolute error | ||
@test maximum(diff ./ magnitude) < tol | ||
|
||
# Relative error | ||
@test maximum(abs, diff ./ Giwn_ref) < tol | ||
end | ||
# Relative error | ||
@test maximum(abs, diff ./ Giwn_ref) < tol | ||
end | ||
end |
Oops, something went wrong.