Skip to content

Commit

Permalink
Add an example for MINARES
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Sep 1, 2023
1 parent dabde1e commit a96379e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/src/examples/minares.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```@example minares
using Krylov, MatrixMarket, SuiteSparseMatrixCollection
using LinearAlgebra, Printf
ssmc = ssmc_db(verbose=false)
matrix = ssmc_matrices(ssmc, "GHS_indef", "laser")
path = fetch_ssmc(matrix, format="MM")
n = matrix.nrows[1]
A = MatrixMarket.mmread(joinpath(path[1], "$(matrix.name[1]).mtx"))
b = ones(n)
# Solve Ax = b.
x, stats = minares(A, b)
show(stats)
r = b - A * x
Ar = A * r
@printf("Relative A-residual: %8.1e\n", norm(A * r) / norm(A * b))
```

0 comments on commit a96379e

Please sign in to comment.