R/e1.R

Defines functions e1

Documented in e1

e1 = function(XpX, eps=1e-8)
{ # Forward Doolittle Method
  eps2 = eps/max(abs(XpX))
  nr = nrow(XpX)
  if (nr > 1) {
    for (i in 1:(nr - 1)) {
      if (abs(XpX[i, i]) < eps) { XpX[i, ] = 0 ; XpX[i:nr, i] = 0 ; next }
      for (j in (i + 1):nr)  XpX[j, ] = XpX[j, ] - XpX[j, i]/XpX[i, i]*XpX[i, ]
      if (abs(XpX[i, i]) > eps) XpX[i, ] = XpX[i, ]/XpX[i, i]
    }
    XpX[abs(XpX) < eps2] = 0
  } else {
    XpX[1, 1] = 1
  }
  rownames(XpX) = paste0("L", 1:nrow(XpX))
  return(XpX) # Do not use zapsmall !
}

Try the sasLM package in your browser

Any scripts or data that you put into this service are public.

sasLM documentation built on Nov. 19, 2023, 5:12 p.m.