R/lorec.R

lorec <- function(Sig, L=NULL, S=NULL, lambda, delta,  thr=1.0e-4, maxit=1e4) {

  p <- nrow(Sig)
  mode(p)="integer"
  if (is.null(L)) L <- diag(diag(Sig))
  if (is.null(S)) S <- diag(diag(Sig))
  
  mode(L)="double"
  mode(S)="double"
  
  mode(Sig)="double"  
  mode(lambda)="double"
  mode(delta)="double"
  mode(thr)="double"
  mode(maxit)="integer"

  junk<-.Fortran("lorec",
                 p,
                 Sig,
                 L=L,
                 S=S,
                 lambda,
                 delta,
                 thr,
                 maxit=maxit,
                 ierr=integer(1),
                 PACKAGE="lorec"
                 )
  
  L = matrix(junk$L, ncol=p)
  S= matrix(junk$S, ncol=p)
  return(list(L=L,S=S))
}

Try the lorec package in your browser

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

lorec documentation built on May 2, 2019, 2:49 p.m.