R: Sum on a simplex

sum.simplex {PhylogeneticEM} | R Documentation

## Sum on a simplex

### Description

`sum.simplex` returns the sum on k_1+...+k_p=K, k_i>0 of the products of NN[i,k_i].

### Usage

    ## S3 method for class 'simplex'
    sum(NN, K, p)

### Arguments

`NN` | a matrix with p rows and K column. Each row contains the number of partition in 1<=k<=K groups for one of the p children of a given node
`K` | an integer. The number of groups wanted.
`p` | an integer. The number of daughters of a node.

### Details

This function uses `xsimplex` to perform the product of NN[i,k_i] for all combination of k_i such that k_1+...+k_p=K, k_i>0, using function `prod.index`. Then sum all the products.

### Value

double : the result of the sum.

[Package PhylogeneticEM version 1.1.0 Index]