weldx.util.xr_matmul#

weldx.util.xr_matmul(a, b, dims_a, dims_b=None, dims_out=None, trans_a=False, trans_b=False, **apply_kwargs)#

Calculate broadcasted np.matmul(a,b) for xarray objects.

Should work for any size and shape of quadratic matrices contained in a DataArray. Ordering, broadcasting of dimensions should be taken care of by xarray internally. This can be used for both matrix * matrix and matrix * vector operations.

Parameters:
  • a – xarray object containing the first matrix

  • b – xarray object containing the second matrix

  • dims_a – name and order of dimensions in the first object

  • dims_b – name and order of dimensions in the second object (if None, use dims_a) (Default value = None)

  • dims_out – name and order of dimensions in the resulting object (if None, use dims_a unless dims_b has less items than dims_b) (Default value = None)

  • trans_a – flag if matrix in a should be transposed (Default value = False)

  • trans_b – flag if matrix in b should be transposed (Default value = False)

  • **apply_kwargs – additional kwargs passed on to ur.apply_ufunc

Return type:

xarray.DataArray