R/isValidBPM.R

Defines functions isValidBPM

Documented in isValidBPM

isValidBPM <- function(U) {
    s1 = colSums(U)
    s2 = rowSums(U)

    if (any(U != 1 && U != 0)) {
        return(FALSE)
    }

    if (max(s1) != 1 || max(s2) != 1) {
        return(FALSE)
    }

    if (min(s2) <= 0) {
        return(FALSE)
    }

    return(TRUE)
}

Try the UNCLES package in your browser

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

UNCLES documentation built on May 2, 2019, 11:11 a.m.