mkT | R Documentation |
Given a multi-index, that is a vector of non-negative integers and a positive integer n
, the function returns all
the lists (v1,...,vn)
of non-negative integer vectors, with the same lenght of the multi-index and such that v=v1+...+vn
.
mkT(v = c(), n = 0, vOutput = FALSE)
v |
vector of integers |
n |
integer, number of addends |
vOutput |
optional boolean variable. If equal to |
From the input vector v
of non-negative integers, which represents the multi-index,
the function produces all the
lists of n
vectors (v1,...,vn)
of non-negative integers, including the zero vector, having the same lenght of
v
and such that their sum gives v
. Note that two lists are different if they contain the same vectors but permuted.
list |
the list of |
The vector in the first variable must be not empty and must contain all non-negative integers. The second parameter must be a positive integer.
Called by the MFB
function in the kStatistics
package.
The routine uses the mkmSet
function in the same package.
Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it
Di Nardo E., Guarino G., Senato D. (2011) A new algorithm for computing the multivariate Faa di Bruno's formula. Appl. Math. Comp. 217, 6286-6295. (download from https://arxiv.org/abs/1012.6008)
mkmSet
,
MFB
# Return the scompositions of the vector (1,1) in 2 vectors of 2 non-negative integers # such that their sum is (1,1), that is # ([1,1],[0,0]) - ([0,0],[1,1]) - ([1,0],[0,1]) - ([0,1],[1,0]) mkT(c(1,1),2) # OR (same output) mkT(c(1,1),2,FALSE) # Return the scompositions of the vector (1,0,1) in 2 vectors of 3 non-negative integers # such that their sum gives (1,0,1), that is # ([1,0,1],[0,0,0]) - ([0,0,0],[1,0,1]) - ([1,0,0],[0,0,1]) - ([0,0,1],[1,0,0]). # Note that the second value in each resulting vector is always zero. mkT(c(1,0,1),2) # OR (same output) mkT(c(1,0,1),2, FALSE) # Return the same output of the previous example but in a compact form. mkT(c(1,0,1),2, TRUE) # Return the scompositions of the vector (1,1,1) in 3 vectors of 3 non-negative integers # such that their sum gives (1,1,1). The result is given in a compact form. for (m in mkT(c(1,1,1),3)) {for (n in m) cat(n," - "); cat("\n")}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.