parameters: (a, b)
return_statement: return wrap(r.astype(result_t))
docstring: Solve a linear matrix equation, or system of linear scalar equations.
  
      Computes the "exact" solution, `x`, of the well-determined, i.e., full
      rank, linear matrix equation `ax = b`.
  
      Parameters
      ----------
      a : (..., M, M) array_like
          Coefficient matrix.
      b : {(..., M,), (..., M, K)}, array_like
          Ordinate or "dependent variable" values.
  
      Returns
      -------
      x : {(..., M,), (..., M, K)} ndarray
          Solution to the system a x = b.  Returned shape is identical to `b`.
  
      Raises
      ------
      LinAlgError
          If `a` is singular or not square.
  
      Notes
      -----
      Broadcasting rules apply, see the `numpy.linalg` documentation for
      details.
  
      The solutions are computed using LAPACK routine _gesv
  
      `a` must be square and of full-rank, i.e., all rows (or, equivalently,
      columns) must be linearly independent; if either is not true, use
      `lstsq` for the least-squares best "solution" of the
      system/equation.
  
      References
      ----------
      .. [1] G. Strang, *Linear Algebra and Its Applications*, 2nd Ed., Orlando,
             FL, Academic Press, Inc., 1980, pg. 22.
  
      Examples
      --------
      Solve the system of equations ``3 * x0 + x1 = 9`` and ``x0 + 2 * x1 = 8``:
  
      >>> a = np.array([[3,1], [1,2]])
      >>> b = np.array([9,8])
      >>> x = np.linalg.solve(a, b)
      >>> x
      array([ 2.,  3.])
  
      Check that the solution is correct:
  
      >>> np.allclose(np.dot(a, x), b)
      True
docstring_summary: Solve a linear matrix equation, or system of linear scalar equations.
docstring_tokens: Solve a linear matrix equation or system of linear scalar equations .
function: def solve(a, b):
      """
      Solve a linear matrix equation, or system of linear scalar equations.
  
      Computes the "exact" solution, `x`, of the well-determined, i.e., full
      rank, linear matrix equation `ax = b`.
  
      Parameters
      ----------
      a : (..., M, M) array_like
          Coefficient matrix.
      b : {(..., M,), (..., M, K)}, array_like
          Ordinate or "dependent variable" values.
  
      Returns
      -------
      x : {(..., M,), (..., M, K)} ndarray
          Solution to the system a x = b.  Returned shape is identical to `b`.
  
      Raises
      ------
      LinAlgError
          If `a` is singular or not square.
  
      Notes
      -----
      Broadcasting rules apply, see the `numpy.linalg` documentation for
      details.
  
      The solutions are computed using LAPACK routine _gesv
  
      `a` must be square and of full-rank, i.e., all rows (or, equivalently,
      columns) must be linearly independent; if either is not true, use
      `lstsq` for the least-squares best "solution" of the
      system/equation.
  
      References
      ----------
      .. [1] G. Strang, *Linear Algebra and Its Applications*, 2nd Ed., Orlando,
             FL, Academic Press, Inc., 1980, pg. 22.
  
      Examples
      --------
      Solve the system of equations ``3 * x0 + x1 = 9`` and ``x0 + 2 * x1 = 8``:
  
      >>> a = np.array([[3,1], [1,2]])
      >>> b = np.array([9,8])
      >>> x = np.linalg.solve(a, b)
      >>> x
      array([ 2.,  3.])
  
      Check that the solution is correct:
  
      >>> np.allclose(np.dot(a, x), b)
      True
  
      """
      a, _ = _makearray(a)
      _assertRankAtLeast2(a)
      _assertNdSquareness(a)
      b, wrap = _makearray(b)
      t, result_t = _commonType(a, b)
  
      # We use the b = (..., M,) logic, only if the number of extra dimensions
      # match exactly
      if b.ndim == a.ndim - 1:
          if a.shape[-1] == 0 and b.shape[-1] == 0:
              # Legal, but the ufunc cannot handle the 0-sized inner dims
              # let the ufunc handle all wrong cases.
              a = a.reshape(a.shape[:-1])
              bc = broadcast(a, b)
              return wrap(empty(bc.shape, dtype=result_t))
  
          gufunc = _umath_linalg.solve1
      else:
          if b.size == 0:
              if (a.shape[-1] == 0 and b.shape[-2] == 0) or b.shape[-1] == 0:
                  a = a[:,:1].reshape(a.shape[:-1] + (1,))
                  bc = broadcast(a, b)
                  return wrap(empty(bc.shape, dtype=result_t))
  
          gufunc = _umath_linalg.solve
  
      signature = 'DD->D' if isComplexType(t) else 'dd->d'
      extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
      r = gufunc(a, b, signature=signature, extobj=extobj)
  
      return wrap(r.astype(result_t))
function_tokens: def solve ( a , b ) : a , _ = _makearray ( a ) _assertRankAtLeast2 ( a ) _assertNdSquareness ( a ) b , wrap = _makearray ( b ) t , result_t = _commonType ( a , b ) # We use the b = (..., M,) logic, only if the number of extra dimensions # match exactly if b . ndim == a . ndim - 1 : if a . shape [ - 1 ] == 0 and b . shape [ - 1 ] == 0 : # Legal, but the ufunc cannot handle the 0-sized inner dims # let the ufunc handle all wrong cases. a = a . reshape ( a . shape [ : - 1 ] ) bc = broadcast ( a , b ) return wrap ( empty ( bc . shape , dtype = result_t ) ) gufunc = _umath_linalg . solve1 else : if b . size == 0 : if ( a . shape [ - 1 ] == 0 and b . shape [ - 2 ] == 0 ) or b . shape [ - 1 ] == 0 : a = a [ : , : 1 ] . reshape ( a . shape [ : - 1 ] + ( 1 , ) ) bc = broadcast ( a , b ) return wrap ( empty ( bc . shape , dtype = result_t ) ) gufunc = _umath_linalg . solve signature = 'DD->D' if isComplexType ( t ) else 'dd->d' extobj = get_linalg_error_extobj ( _raise_linalgerror_singular ) r = gufunc ( a , b , signature = signature , extobj = extobj ) return wrap ( r . astype ( result_t ) )