Skip to content

Commit

Permalink
add suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxenceGollier committed Oct 8, 2024
1 parent a67eb9e commit abc8368
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/src/tutorials/qless.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ val = [1.0, 2.0, 3.0, 1.0, 1.0, 2.0, 4.0, 1.0, 5.0, 1.0, 3.0, 6.0, 1.0]
A = sparse(irn, jcn, val, m, n)
b = [40.0, 10.0, 44.0, 98.0, 87.0]
y_star = [0.0, 1.0, 2.0, 3.0, 4.0]
y_star = [16.0, 1.0, 10.0, 3.0, 19.0, 3.0, 2.0]
y₁ = zeros(n)
y₂ = zeros(m)
y₃ = zeros(n)
# Initialize QRMumps
qrm_init()
Expand All @@ -36,11 +37,11 @@ qrm_solve!(spfct, y₁, y₂; transp='n')
# Overall, RᵀRy₂ = b. Equivalently, RᵀQᵀQRy₂ = b or AAᵀy₂ = b
# Compute least norm solution of min ‖b - Ax‖
x = A'*y₂
y₃ .= A'*y₂
# Compute error norm and residual norm
error_norm = norm(y - y_star)
residual_norm = norm(b - A*x)
error_norm = norm(y - y_star)
residual_norm = norm(b - A*y₃)
@printf("Error norm ‖y* - y‖ = %10.5e\n", error_norm)
@printf("Residual norm ‖b - Ax‖ = %10.5e\n", residual_norm)
Expand Down

0 comments on commit abc8368

Please sign in to comment.