R/normalizeAdj.R

Defines functions normalizeAdj

normalizeAdj <-
function(Amat, alpha = 1) {
    if (is.null(dim(Amat))) {
      ncond = length(Amat)
      p = nrow(Amat[[1]])
    } else {
      ncond <- 1
      p <- dim(Amat)[1]
      Amat <- list(Amat)
    }
    
    LapMat = Amat 
    Lmat = Amat
    normA = Amat
    InfMat = Amat
    
    Ip = diag(rep(1, p), p, p)
    
    for (i in 1:ncond) {
      LapResults = graphlaplacian(Amat[[i]])
      LapMat[[i]] = LapResults$Lnorm
      Lmat[[i]] = LapResults$Lunnorm
      normA[[i]] = alpha * LapMat[[i]]
      InfMat[[i]] = t(cholCpp(pseudoinverse(Ip - normA[[i]]))) 
    }
    
    return(list(normA = normA, Lmat = Lmat, LapMat = LapMat, InfMat = InfMat))
  }

Try the netgsa package in your browser

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

netgsa documentation built on Nov. 14, 2023, 5:09 p.m.