R/snlsMat.R

Defines functions snlsMat

snlsMat <- function(x){
  
  tn <- max(nrow(X),ncol(X))
  n <- floor(sqrt(2*tn))
  E <- matrix(rep(TRUE,n^2),nrow=n)
  indsu <- E[upper.tri(E,diag=TRUE)]
  indsuu <- E[upper.tri(E,diag=FALSE)]
  X <- matrix(rep(0,n^2))
  X[indsu] <- x
  v <- diag(X)
  diag(X) <- 0
  X[indsuu] <- X[indsuu]/sqrt(2)
  X <- X + t(X)
  X <- X+diag(v)
  return(X)
}

Try the edmcr package in your browser

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

edmcr documentation built on Sept. 10, 2021, 5:10 p.m.