1 ## is.compatible.R (2011-10-11)
3 ## Check Compatibility of Splits
5 ## Copyright 2011 Andrei-Alin Popescu
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 is.compatible <- function(obj) UseMethod("is.compatible")
12 is.compatible.bitsplits <- function(obj)
16 ntaxa <- length(obj$labels)
19 if (!arecompatible(m[, i], m[, j], ntaxa))
24 arecompatible <-function(x, y, n)
26 msk <- !as.raw(2^(8 - (n %% 8)) - 1)
31 as.integer(all(v == as.raw(0)))
34 nE <- foo(x & y) + foo(x & !y) + foo(!x & y) + foo(!x & !y)
35 if (nE == 1) TRUE else FALSE