prod_index: Product of elements of a matrix

View source: R/partitionsNumber.R

prod_indexR Documentation

Product of elements of a matrix

Description

prod_index return the product of chosen elements of a matrix.

Usage

prod_index(X, Id)

Arguments

X

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

Id

a vector of length p, result of the function xsimplex.

Details

This function is to be used in sum_simplex to be applied to all the elements given by xsimplex. Performs the product : X[1,Id[1]]*X[2,Id[2]]*...*X[p,Id[p]] if all the elements of Id are positive. Otherwise, just return 0.

Value

double : the result of the product.


pbastide/PhylogeneticEM documentation built on Feb. 12, 2024, 1:27 a.m.