mushi.composition.inner

inner(x, y)[source]

Calculates the Aitchson inner product.

This inner product is defined as follows

x,ya=12Di=1Dj=1Dln(xixj)ln(yiyj)
Parameters:
  • x (array_like) – a matrix of proportions where rows = compositions and columns = components

  • y (array_like) – a matrix of proportions where rows = compositions and columns = components

Returns:

inner product result

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> import mushi.composition as cmp
>>> x = np.array([.1, .3, .4, .2])
>>> y = np.array([.2, .4, .2, .2])
>>> cmp.inner(x, y)  
Array(0.21078525, dtype=float64)