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))
 Downloading artifact: GHS_indef/laser.MM
SimpleStats
 niter: 49
 solved: true
 inconsistent: false
 residuals: []
 Aresiduals: []
 κ₂(A): []
 timer: 896.26μs
 status: solution good enough given atol, rtol and Artol
Relative A-residual:  7.8e-09