R/GtoD2.r

Defines functions GtoD2

Documented in GtoD2

  #######################
  #### function GtoD2 ####
  #######################
  
  
 GtoD2 <- function(G){
  
  if (!inherits(G,"Gram"))
   stop(" 'G' must be of class Gram")
   
  n<-ncol(G)
  onesn <- matrix(rep(1,n),nrow=n) #ones vector
  
  Delta<-t(t(diag(G)))%*%t(onesn)+onesn%*%t(diag(G))-2*G
  class(Delta)<-"D2"
  return(Delta)
 }

Try the dbstats package in your browser

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

dbstats documentation built on Dec. 7, 2022, 5:14 p.m.