R/comp.psm.R

Defines functions `comp.psm`

`comp.psm` <-
function(cls) {
  
    n <- ncol(cls)
    M <- nrow(cls)

    if(sum(cls %in% (1:n)) < n * M){
        stop("All elements of cls must be integers in 1:nobs")
    }   
    cls.C <- as.vector(t(cls))
    psm <- rep(0,n^2)
    psm <- matrix(.C("comp_psm", as.integer(psm), as.integer(cls.C), as.integer(n), as.integer(M))[[1]]/M,ncol=n) 
    psm
}

Try the mcclust package in your browser

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

mcclust documentation built on May 2, 2022, 5:05 p.m.