yaw.core.math.outer_triu_sum#
- yaw.core.math.outer_triu_sum(a: ArrayLike, b: ArrayLike, *, k: int = 0, axis: int | None = None) NDArray[source]#
Compute the sum over the upper triangle of the outer product.
Shapes of input array must be identical. Equivalent to
>>> np.triu(np.outer(a, b), k).sum(axis)
but supports extra dimensions in a and b and does not construct the full outer product matrix in memory.
- Parameters:
a (
NDArray) – First input array.b (
NDArray) – Second input array.
- Keyword Arguments:
k (
int, optional) – Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.axis (
int, optional) – Array axis over which the outer product is summed. All by default.