R/buildMatrix.R

Defines functions buildMatrix

buildMatrix <- function(UnknownEntries, KnownEntries,Index,NRows){
    
  KnownEntries <- KnownEntries^2
  
  Matrix <- matrix(rep(-1,NRows^2),nrow=NRows)
  Matrix[Index] <- UnknownEntries
  Matrix[lower.tri(Matrix)][which(Matrix[lower.tri(Matrix)] == -1)] <- KnownEntries
  Matrix[upper.tri(Matrix)] <- t(Matrix)[upper.tri(Matrix)]
  diag(Matrix) <- 0
  
  return(Matrix)
  
}

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.