A <- matrix(c(0.46, 0.60, 0.74, 0.61, 0.85,
0.56, 0.31, 0.80, 0.94, 0.76,
0.41, 0.19, 0.15, 0.33, 0.06,
0.03, 0.92, 0.15, 0.56, 0.08,
0.09, 0.06, 0.69, 0.42, 0.96), 5, 5)
x <- c(0.1, 0.3, 0.5, 0.7, 0.9)
b <- A %*% x
gmres(A, b)
# $x
# [,1]
# [1,] 0.1
# [2,] 0.3
# [3,] 0.5
# [4,] 0.7
# [5,] 0.9
#
# $error
# [1] 2.37446e+00 1.49173e-01 1.22147e-01 1.39901e-02 1.37817e-02 2.81713e-31
#
# $niter
# [1] 5
Run the code above in your browser using DataLab