From 82779c9ec276b3f4962837549b794ef1cb813ce1 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Sun, 13 Oct 2024 22:47:31 -0500 Subject: [PATCH] wip --- docs/src/examples/usymlqr.md | 10 ++++------ src/usymlqr.jl | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/src/examples/usymlqr.md b/docs/src/examples/usymlqr.md index 5fcbb19d6..903daa8aa 100644 --- a/docs/src/examples/usymlqr.md +++ b/docs/src/examples/usymlqr.md @@ -1,5 +1,5 @@ ```@example usymlqr -using Krylov, LinearOperators, LDLFactorizations +using Krylov, LinearOperators using LinearAlgebra, Printf, SparseArrays # Identity matrix. @@ -15,13 +15,11 @@ c = -b # [D A] [x] = [b] # [Aᴴ 0] [y] [c] -llt_D = cholesky(D) -opD⁻¹ = LinearOperator(Float64, 5, 5, true, true, (y, v) -> ldiv!(y, llt_D, v)) -opH⁻¹ = BlockDiagonalOperator(opD⁻¹, eye(n)) -(x, y, stats) = usymlqr(A, b, c, M=opD⁻¹, sp=true) +opH = BlockDiagonalOperator(inv(D), eye(n)) +(x, y, stats) = usymlqr(A, b, c, M=D, ldiv=true) K = [D A; A' zeros(n,n)] B = [b; c] r = B - K * [x; y] -resid = sqrt(dot(r, opH⁻¹ * r)) +resid = sqrt(dot(r, opH * r)) @printf("USYMLQR: Relative residual: %8.1e\n", resid) ``` diff --git a/src/usymlqr.jl b/src/usymlqr.jl index 4765472d1..bf5db31f8 100644 --- a/src/usymlqr.jl +++ b/src/usymlqr.jl @@ -215,6 +215,7 @@ kwargs_usymlqr = (:transfer_to_usymcg, :M, :N, :ldiv, :atol, :rtol, :itmax, :tim kdisplay(iter, verbose) && @printf(iostream, "%4d %7.1e %7.1e %7.1e\n", iter, αₖ, βₖ, γₖ) # Stopping criterion. + rNorm = β₁ solved = rNorm ≤ ε tired = iter ≥ itmax status = "unknown"