cgls: Conjugate gradient Least squares

View source: R/cgls.R

cglsR Documentation

Conjugate gradient Least squares

Description

Conjugate gradient Least squares

Usage

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

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




PEIP documentation built on Aug. 21, 2023, 9:10 a.m.