Skip to content

average_onto_simplex

average_onto_simplex(A, T)

Average quantity from vertices to simplices

Parameters:

Name Type Description Default
A (n, d) numpy float array

Per vertex d-dimensional quantities

required
T (t, s) numpy int array

Simplex indices

required

Returns:

Name Type Description
At (t, d) numpy float array

Per simplex d-dimensional quantities

Source code in src\fast_cody\average_onto_simplex.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def average_onto_simplex(A, T):
    """ Average quantity from vertices to simplices
    Parameters
    ----------
    A : (n, d) numpy float array
        Per vertex d-dimensional quantities
    T : (t, s) numpy int array
        Simplex indices

    Returns
    -------
    At : (t, d) numpy float array
        Per simplex d-dimensional quantities
    """
    At = np.zeros((T.shape[0], A.shape[1]))
    for td in range(T.shape[1]):
        At += (A[T[:, td], :])/T.shape[1]

    return At