Conjugate gradient Least squares
Conjugate gradient Least squares
cgls(Gmat, dee, niter)
Gmat |
input matrix |
dee |
right hand side |
niter |
max number of iterations |
Performs niter iterations of the CGLS algorithm on the least squares problem min norm(G*m-d). Gmat should be a sparse matrix.
X |
matrix of models |
rho |
misfit norms |
eta |
model norms |
Jonathan M. Lees<jonathan.lees@unc.edu>
Aster, R.C., C.H. Thurber, and B. Borchers, Parameter Estimation and Inverse Problems, Elsevier Academic Press, Amsterdam, 2005.
set.seed(11) #### perfect data with no noise n <- 5 A <- matrix(runif(n*n),nrow=n) B <- runif(n) ### get right-hand-side (data) trhs = as.vector( A %*% B ) Lout = cgls(A, trhs , 15) ### solution is Lout$X[,15] Lout$X[,15] - B
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.