# xarray.dot

`xarray.``dot`(*arrays, dims=None, **kwargs)

  Generalized dot product for xarray objects. Like np.einsum, but provides a simpler interface based on array dimensions.

  Parameters:

  - arrays (DataArray (or Variable) objects) – Arrays to compute.
  - dims ('...', str or tuple of strings, optional) – Which dimensions to sum over. Ellipsis (‘…’) sums over all dimensions. If not specified, then all the common dimensions are summed over.
  - **kwargs (dict) – Additional keyword arguments passed to numpy.einsum or dask.array.einsum

  Returns: | dot
  Return type: | DataArray

  Examples

      >>> import numpy as np
      >>> import xarray as xr
      >>> da_a = xr.DataArray(np.arange(3 * 2).reshape(3, 2), dims=['a', 'b'])
      >>> da_b = xr.DataArray(np.arange(3 * 2 * 2).reshape(3, 2, 2),
      ...                     dims=['a', 'b', 'c'])
      >>> da_c = xr.DataArray(np.arange(2 * 3).reshape(2, 3), dims=['c', 'd'])

      >>> da_a
      <xarray.DataArray (a: 3, b: 2)>
      array([[0, 1],
             [2, 3],
             [4, 5]])
      Dimensions without coordinates: a, b

      >>> da_b
      <xarray.DataArray (a: 3, b: 2, c: 2)>
      array([[[ 0,  1],
              [ 2,  3]],
             [[ 4,  5],
              [ 6,  7]],
             [[ 8,  9],
              [10, 11]]])
      Dimensions without coordinates: a, b, c

      >>> da_c
      <xarray.DataArray (c: 2, d: 3)>
      array([[0, 1, 2],
             [3, 4, 5]])
      Dimensions without coordinates: c, d

      >>> xr.dot(da_a, da_b, dims=['a', 'b'])
      <xarray.DataArray (c: 2)>
      array([110, 125])
      Dimensions without coordinates: c

      >>> xr.dot(da_a, da_b, dims=['a'])
      <xarray.DataArray (b: 2, c: 2)>
      array([[40, 46],
             [70, 79]])
      Dimensions without coordinates: b, c

      >>> xr.dot(da_a, da_b, da_c, dims=['b', 'c'])
      <xarray.DataArray (a: 3, d: 3)>
      array([[  9,  14,  19],
             [ 93, 150, 207],
             [273, 446, 619]])
      Dimensions without coordinates: a, d

      >>> xr.dot(da_a, da_b)
      <xarray.DataArray (c: 2)>
      array([110, 125])
      Dimensions without coordinates: c

      >>> xr.dot(da_a, da_b, dims=...)
      <xarray.DataArray ()>
      array(235)