Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxenceGollier committed Jul 22, 2024
1 parent 4e5eb81 commit a98097c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/src/tutorials/qless.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
```@example qless1
using QRMumps, LinearAlgebra, SparseArrays, Printf
m, n = 5, 7
irn = [1, 3, 5, 2, 3, 5, 1, 4, 4, 5, 2, 1, 3]
jcn = [1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7]
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, 5, 7)
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₁ = similar(b,7)
y₂ = similar(b)
y₁ = zeros(n)
y₂ = zeros(m)
qrm_init()
spmat = qrm_spmat_init(A)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')
qrm_set(spfct, "qrm_keeph", 0)
qrm_analyse!(spmat, spfct; transp='t')
qrm_factorize!(spmat, spfct, transp='t')
qrm_solve!(spfct, b, y₁; transp='t')
Expand All @@ -30,11 +32,12 @@ error_norm = norm(y₂ - y_star)
```@example qless2
using QRMumps, LinearAlgebra, SparseArrays, Printf
m, n = 7, 5
irn = [1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7]
jcn = [1, 3, 5, 2, 3, 5, 1, 4, 4, 5, 2, 1, 3]
val = [1.0, 2.0, 3.0, 1.0, 1.0, 2.0, 4.0, 1.0, 3.0, 1.0, 3.0, 2.0, 1.0]
A = sparse(irn, jcn, val, 7, 5)
A = sparse(irn, jcn, val, m, n)
b = [22.0, 2.0, 13.0, 8.0, 17.0, 6.0, 5.0]
x_star = [1.0, 2.0, 3.0, 4.0, 5.0]
Expand Down

0 comments on commit a98097c

Please sign in to comment.