diff --git a/src/LearningRateSchedulers.jl b/src/LearningRateSchedulers.jl index 530501dcf..b5701acdb 100644 --- a/src/LearningRateSchedulers.jl +++ b/src/LearningRateSchedulers.jl @@ -222,6 +222,7 @@ $(DocStringExtensions.TYPEDSIGNATURES) Makes square matrix `mat` positive definite, by symmetrizing and bounding the minimum eigenvalue below by `tol` """ function posdef_correct(mat::AbstractMatrix; tol::Real = 1e8 * eps()) + mat = deepcopy(mat) if !issymmetric(mat) out = 0.5 * (mat + permutedims(mat, (2, 1))) #symmetrize if isposdef(out) diff --git a/test/EnsembleKalmanProcess/runtests.jl b/test/EnsembleKalmanProcess/runtests.jl index 914be0458..e60044d72 100644 --- a/test/EnsembleKalmanProcess/runtests.jl +++ b/test/EnsembleKalmanProcess/runtests.jl @@ -278,6 +278,7 @@ end else #no initial ensemble for UKI ekpobj = EKP.EnsembleKalmanProcess(y_obs, Γy, process, rng = copy(rng), scheduler = scheduler) end + initial_obs_noise_cov = deepcopy(ekpobj.obs_noise_cov) for i in 1:N_iter params_i = get_ϕ_final(prior, ekpobj) g_ens = G(params_i) @@ -290,9 +291,13 @@ end if !isnothing(terminated) break end + # ensure Δt is updated + @test length(ekpobj.Δt) == i end push!(init_means, vec(mean(get_u_prior(ekpobj), dims = 2))) push!(final_means, vec(mean(get_u_final(ekpobj), dims = 2))) + # ensure obs_noise_cov matrix remains unchanged + @test initial_obs_noise_cov == ekpobj.obs_noise_cov # this test is fine so long as N_iter is large enough to hit the termination time if nameof(typeof(scheduler)) == DataMisfitController