# gcval: Get c-val In PEIP: Geophysical Inverse Theory and Optimization

## Description

Extract the smallest regularization parameter.

## Usage

 `1` ```gcval(U, s, b, npoints) ```

## Arguments

 `U` U matrix from gsvd(G, L) `s` [diag(C) diag(S)] which are the lambdas and mus from the gsvd `b` the data to try and match `npoints` number of alphas to estimate

## Details

Evaluate the GCV function gcv_function at npoints points.

## Value

List:

 `reg_min` alpha with the minimal g (scalar) `g ` || Gm_(alpha,L) - d ||^2 / (Tr(I - GG#)^2 `alpha` alpha for the corresponding g

## Author(s)

Jonathan M. Lees<[email protected]>

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32``` ```set.seed(2015) VSP = vspprofile() t = VSP\$t2 G = VSP\$G M = VSP\$M N = VSP\$N L1 = get_l_rough(N,1); littleU = PEIP::GSVD(as.matrix(G), as.matrix(L1) ); BIGU = flipGSVD(littleU, dim(G), dim(L1) ) U1 = BIGU\$U V1 =BIGU\$V X1=BIGU\$X Lam1=BIGU\$C M1=BIGU\$S lam=sqrt(diag(t(Lam1 %*% Lam1))); mu=sqrt(diag(t(M1)%*%M1)); p=rnk(L1); sm1=cbind(lam[1:p],mu[1:p]) ### % get the gcv values varying alpha ### ngcvpoints=1000; HI = gcval(U1,sm1,t,ngcvpoints); ```