treeToPoly | R Documentation |
Converts rooted full binary trees to tree distinguishing polynomials described with coefficient matrices.
treeToPoly( trees, type = c("default", "yEvaluated", "tipLabel"), y, varLabels = FALSE, numThreads = -1 )
trees |
a single phylo object or a list of phylo objects |
type |
one of:
|
y |
the y value to evaluate the polynomial at when type is “yEvaluated”, ignored otherwise |
varLabels |
boolean for whether to add row and column names corresponding to the variables in the polynomial |
numThreads |
number of threads to be used, the default (-1) will use the number of cores in the machine and numThreads = 0 will only use the main thread |
the resulting coefficient matrix or matrices of the form:
a real matrix where the ith row, jth column represents the x^(j-1)*y^(i-1) coefficient
a vector where the kth column represents the x^(k-1) coefficient
given trees with two unique tip labels “a”, “b” a complex matrix where the ith row, jth column represents the a^(i-1)*b^(j-1) coefficient
library(treenomial) library(ape) # generate a tree tree <- rtree(n = 30, rooted = TRUE) # a real coefficient matrix treeToPoly(tree, varLabels = TRUE, numThreads = 0) # complex coefficient vector for the tree treeToPoly(tree, type = "yEvaluated", y = 1+1i, varLabels = TRUE, numThreads = 0) # for a list of trees treeToPoly(rmtree(4, 20), varLabels = TRUE, numThreads = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.