From 2b929265aceacac7b50ba8e29f00b0d14de3fa50 Mon Sep 17 00:00:00 2001 From: Samuel Badr Date: Fri, 22 Sep 2023 11:47:45 +0200 Subject: [PATCH] Allow different kernels in finite_temp_bases --- src/basis.jl | 8 +++++--- test/basis.jl | 2 +- test/freq.jl | 4 ++-- test/runtests.jl | 30 ++++++++++++++---------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/basis.jl b/src/basis.jl index 4c4e2b0..371a0c5 100644 --- a/src/basis.jl +++ b/src/basis.jl @@ -153,13 +153,15 @@ function rescale(basis::FiniteTempBasis, new_β) end """ - finite_temp_bases(β, ωmax, ε, sve_result=SVEResult(LogisticKernel(β * ωmax); ε)) + finite_temp_bases(β::Real, ωmax::Real, ε=nothing; + kernel=LogisticKernel(β * ωmax), sve_result=SVEResult(kernel; ε)) Construct `FiniteTempBasis` objects for fermion and bosons using the same `LogisticKernel` instance. """ -function finite_temp_bases(β::Real, ωmax::Real, ε=nothing, - sve_result=SVEResult(LogisticKernel(β * ωmax); ε)) +function finite_temp_bases(β::Real, ωmax::Real, ε=nothing; + kernel=LogisticKernel(β * ωmax), + sve_result=SVEResult(kernel; ε)) basis_f = FiniteTempBasis{Fermionic}(β, ωmax, ε; sve_result) basis_b = FiniteTempBasis{Bosonic}(β, ωmax, ε; sve_result) return basis_f, basis_b diff --git a/test/basis.jl b/test/basis.jl index b15d1d0..e16358e 100644 --- a/test/basis.jl +++ b/test/basis.jl @@ -22,7 +22,7 @@ isdefined(Main, :sve_logistic) || include("_conftest.jl") ε = 1e-5 sve_result = sve_logistic[β * ωmax] - basis_f, basis_b = SparseIR.finite_temp_bases(β, ωmax, ε, sve_result) + basis_f, basis_b = SparseIR.finite_temp_bases(β, ωmax, ε; sve_result) smpl_τ_f = TauSampling(basis_f) smpl_τ_b = TauSampling(basis_b) smpl_wn_f = MatsubaraSampling(basis_f) diff --git a/test/freq.jl b/test/freq.jl index fe4153f..e6cadc0 100644 --- a/test/freq.jl +++ b/test/freq.jl @@ -11,8 +11,8 @@ using SparseIR @test Int(MatsubaraFreq(Int32(4))) == 4 - @test_throws ErrorException FermionicFreq(4) - @test_throws ErrorException BosonicFreq(-7) + @test_throws DomainError FermionicFreq(4) + @test_throws DomainError BosonicFreq(-7) @test FermionicFreq(5) < BosonicFreq(6) @test BosonicFreq(6) >= BosonicFreq(6) diff --git a/test/runtests.jl b/test/runtests.jl index 8bfc529..b73e06e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,21 +5,19 @@ include("_conftest.jl") Aqua.test_all(SparseIR; ambiguities=false, piracy=false) -@testset verbose=true "SparseIR.jl" begin - include("freq.jl") - include("gauss.jl") - include("kernel.jl") - include("poly.jl") - include("sve.jl") - include("svd.jl") - include("basis.jl") - include("sampling.jl") - include("augment.jl") - include("dlr.jl") - include("_linalg.jl") - include("_roots.jl") - include("_specfuncs.jl") - include("_multifloat_funcs.jl") -end +include("freq.jl") +include("gauss.jl") +include("kernel.jl") +include("poly.jl") +include("sve.jl") +include("svd.jl") +include("basis.jl") +include("sampling.jl") +include("augment.jl") +include("dlr.jl") +include("_linalg.jl") +include("_roots.jl") +include("_specfuncs.jl") +include("_multifloat_funcs.jl") nothing # without this we get messy output from the testset printed in the REPL