parameters: (lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True)
return_statement: return x[..., 0] if rhs_vector else x
docstring: Solve an equation system, a x = b, given the LU factorization of a
  
      Args:
          lu_and_piv (Tensor, Tensor): Factorization of the coefficient matrix a, as given by lu_factor
          b (Tensor): Right-hand side
          trans (int, optional): {0, 1, 2}
              Type of system to solve:
              =====  =========
              trans  system
              =====  =========
              0      a x   = b
              1      a^T x = b
              2      a^H x = b
              =====  =========
          overwrite_b (bool, optional): Whether to overwrite data in b (may increase performance)
          check_finite ( bool, optional): Whether to check that the input matrices contain only finite numbers.
              Disabling may give a performance gain, but may result in problems (crashes, non-termination)
              if the inputs do contain infinities or NaNs.
  
      Returns:
          Tesnor, solution to the system
  
      Supported Platforms:
          ``CPU`` ``GPU``
  
      Examples:
          >>> import numpy as onp
          >>> from mindspore.common import Tensor
          >>> from mindspore.scipy.linalg import lu_factor, lu_solve
          >>> A = Tensor(onp.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]]).astype(onp.float64))
          >>> b = Tensor(onp.array([1, 1, 1, 1]).astype(onp.float64))
          >>> lu, piv = lu_factor(A)
          >>> lu_solve((lu, piv), b)
          [ 0.05154639, -0.08247423,  0.08247423,  0.09278351]
docstring_summary: Solve an equation system, a x = b, given the LU factorization of a
docstring_tokens: Solve an equation system a x = b given the LU factorization of a
function: def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
      """Solve an equation system, a x = b, given the LU factorization of a
  
      Args:
          lu_and_piv (Tensor, Tensor): Factorization of the coefficient matrix a, as given by lu_factor
          b (Tensor): Right-hand side
          trans (int, optional): {0, 1, 2}
              Type of system to solve:
              =====  =========
              trans  system
              =====  =========
              0      a x   = b
              1      a^T x = b
              2      a^H x = b
              =====  =========
          overwrite_b (bool, optional): Whether to overwrite data in b (may increase performance)
          check_finite ( bool, optional): Whether to check that the input matrices contain only finite numbers.
              Disabling may give a performance gain, but may result in problems (crashes, non-termination)
              if the inputs do contain infinities or NaNs.
  
      Returns:
          Tesnor, solution to the system
  
      Supported Platforms:
          ``CPU`` ``GPU``
  
      Examples:
          >>> import numpy as onp
          >>> from mindspore.common import Tensor
          >>> from mindspore.scipy.linalg import lu_factor, lu_solve
          >>> A = Tensor(onp.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]]).astype(onp.float64))
          >>> b = Tensor(onp.array([1, 1, 1, 1]).astype(onp.float64))
          >>> lu, piv = lu_factor(A)
          >>> lu_solve((lu, piv), b)
          [ 0.05154639, -0.08247423,  0.08247423,  0.09278351]
      """
      m_lu, pivots = lu_and_piv
      # 1. check shape
      check_lu_shape(m_lu, b)
      # here permutation array has been calculated, just use it.
      # 2. calculate permutation
      permutation = lu_pivots_to_permutation(pivots, len(pivots))
      # 3. rhs_vector
      rhs_vector = m_lu.ndim == b.ndim + 1
      x = lu_solve_core(m_lu, permutation, b, trans)
      return x[..., 0] if rhs_vector else x
function_tokens: def lu_solve ( lu_and_piv , b , trans = 0 , overwrite_b = False , check_finite = True ) : m_lu , pivots = lu_and_piv # 1. check shape check_lu_shape ( m_lu , b ) # here permutation array has been calculated, just use it. # 2. calculate permutation permutation = lu_pivots_to_permutation ( pivots , len ( pivots ) ) # 3. rhs_vector rhs_vector = m_lu . ndim == b . ndim + 1 x = lu_solve_core ( m_lu , permutation , b , trans ) return x [ ... , 0 ] if rhs_vector else x