Conjugate gradient Least squares

Description

Conjugate gradient Least squares

Usage

1
cgls(Gmat, dee, niter)

Arguments

Gmat

input matrix

dee

right hand side

niter

max number of iterations

Details

Performs niter iterations of the CGLS algorithm on the least squares problem min norm(G*m-d). Gmat should be a sparse matrix.

Value

X

matrix of models

rho

misfit norms

eta

model norms

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

References

Aster, R.C., C.H. Thurber, and B. Borchers, Parameter Estimation and Inverse Problems, Elsevier Academic Press, Amsterdam, 2005.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.