aspcore.matrices.broadcast_func

aspcore.matrices.broadcast_func(mat, func, *args, out_shape=None, dtype=<class 'float'>, **kwargs)

Applies the same function to each matrix in the array

Parameters:
  • mat (ndarray of shape (*tuple, a, b)) – or tuple of ndarrays of shape (a, b)

  • func (function) – function to be applied to the matrices in the last two axes

  • out_shape (tuple of ints) – shape of the output for a single matrix must be provided if the output is not a scalar

  • dtype (type)

  • kwargs (dict) – passed to func

Returns:

output

Return type:

ndarray of shape (*tuple, out_shape)