Learn R Programming

PEIP (version 2.2-5)

cgls: Conjugate gradient Least squares

Description

Conjugate gradient Least squares

Usage

cgls(Gmat, dee, niter)

Value

X

matrix of models

rho

misfit norms

eta

model norms

Arguments

Gmat

input matrix

dee

right hand side

niter

max number of iterations

Author

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

Details

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

References

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

Examples

Run this code
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



Run the code above in your browser using DataLab