einsum_norm

ssapy.utils.einsum_norm(a, indices='ij,ji->i')[source][source]

Compute the norm of an array using Einstein summation notation with customizable indices.

This function calculates the norm of an input array using np.einsum with user-defined summation indices. By default, it computes the Euclidean norm along the specified axes using the provided summation pattern. The result is the square root of the summation output.

Parameters:

aarray-like

Input array for which the norm is computed. The array can have any shape, and the summation pattern determines how the norm is calculated across its dimensions.

indicesstr, optional

A string representing the Einstein summation pattern. The default value is ‘ij,ji->i’, which computes the norm along specific axes. Users can customize this pattern to suit their needs.

Returns:

normarray-like

The computed norm of the input array based on the specified summation pattern. The output shape depends on the summation indices provided.