From c047ccf33c0605bc31e1e646a203d4a412a872ee Mon Sep 17 00:00:00 2001 From: "Fernando P.Panadero" Date: Mon, 9 Sep 2024 15:42:38 +0200 Subject: [PATCH] bfl_error function --- src/Dirac/Diracflow.jl | 21 +++++++++++++++++++++ src/LatticeGPU.jl | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Dirac/Diracflow.jl b/src/Dirac/Diracflow.jl index 62529e2..980a12a 100644 --- a/src/Dirac/Diracflow.jl +++ b/src/Dirac/Diracflow.jl @@ -318,6 +318,27 @@ end export Nablanabla!, flw, backflow, flw_adapt, bflw_step! +""" + function bfl_error(psi_t, psi_0, U, tend, int::FlowIntr, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) + +Estimates the error of the backflow integration of psi_t into psi_0 with a random noise source. +""" +function bfl_error(psi_t, psi_0, U, tend, int::FlowIntr, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) + + pfrandomize!(dws.sr,lp) + @timeit "GPU to CPU" V = Array(U) + + R0 = sum(dot.(psi_0,dws.sr)) + + flw_adapt(U, dws.sr, int, tend, int.eps_ini/2, gp, dpar, lp, ymws, dws) + + R1 = sum(dot.(psi_t,dws.sr)) + @timeit "CPU to GPU" copyto!(U,V) + + return abs(R0-R1) +end + +export bfl_error """ function Dslash_sq!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm{4,6,B,D}) diff --git a/src/LatticeGPU.jl b/src/LatticeGPU.jl index 46f5ac6..0b830ee 100644 --- a/src/LatticeGPU.jl +++ b/src/LatticeGPU.jl @@ -60,7 +60,7 @@ using .Dirac export DiracWorkspace, DiracParam export Dw!, g5Dw!, DwdagDw!, SF_bndfix!, Csw!, pfrandomize!, mtwmdpar export read_prop, save_prop, read_dpar -export Nablanabla!, flw, backflow +export Nablanabla!, flw, backflow, bfl_error include("Solvers/Solvers.jl") using .Solvers