docs: def ddot(L, R, left=None, out=None):
      r"""Dot product of a matrix and a diagonal one.
  
      Args:
          L (array_like): Left matrix.
          R (array_like): Right matrix.
          out (:class:`numpy.ndarray`, optional): copy result to.
  
      Returns:
          :class:`numpy.ndarray`: Resulting matrix.
      """
      L = asarray(L, float)
      R = asarray(R, float)
      if left is None:
          ok = min(L.ndim, R.ndim) == 1 and max(L.ndim, R.ndim) == 2
          if not ok:
              msg = "Wrong array layout. One array should have"
              msg += " ndim=1 and the other one ndim=2."
              raise ValueError(msg)
          left = L.ndim == 1
      if left:
          if out is None:
              out = copy(R)
          L = L.reshape(list(L.shape) + [1] * (R.ndim - 1))
          return multiply(L, R, out=out)
      else:
          if out is None:
              out = copy(L)
          return multiply(L, R, out=out)