code: def test_lu_execution(setup):
      rs = np.random.RandomState(0)
  
      # square matrix
      data = rs.randint(1, 10, (6, 6))
  
      a = tensor(data)
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      a = tensor(data, chunk_size=(3, 4))
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      # shape[0] > shape[1]
      data = rs.randint(1, 10, (10, 6))
  
      a = tensor(data)
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      a = tensor(data, chunk_size=5)
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      a = tensor(data, chunk_size=(4, 5))
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      # shape[0] < shape[1]
      data = rs.randint(1, 10, (6, 10))
  
      a = tensor(data)
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      a = tensor(data, chunk_size=5)
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      a = tensor(data, chunk_size=(4, 5))
      P, L, U = lu(a)
  
      # check lower and upper triangular matrix
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data)
  
      # test for sparse
      data = sps.csr_matrix(
          [
              [2, 0, 0, 0, 5, 2],
              [0, 6, 1, 0, 0, 6],
              [8, 0, 9, 0, 0, 2],
              [0, 6, 0, 8, 7, 3],
              [7, 0, 6, 1, 7, 0],
              [0, 0, 0, 7, 0, 8],
          ]
      )
  
      a = tensor(data)
      P, L, U = lu(a)
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      # check lower and upper triangular matrix
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
      assert isinstance(result_l, SparseNDArray)
      assert isinstance(result_u, SparseNDArray)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_array_almost_equal(data.A, res)
  
      a = tensor(data, chunk_size=5)
      P, L, U = lu(a)
      result_l = L.execute().fetch()
      result_u = U.execute().fetch()
  
      # check lower and upper triangular matrix
      np.testing.assert_allclose(np.tril(result_l), result_l)
      np.testing.assert_allclose(np.triu(result_u), result_u)
      assert isinstance(result_l, SparseNDArray)
      assert isinstance(result_u, SparseNDArray)
  
      t = P.dot(L).dot(U)
      res = t.execute().fetch()
      np.testing.assert_array_almost_equal(data.A, res)
  
imports: import numpy
  import scipy.sparse
  from ....learn.datasets.samples_generator import make_low_rank_matrix
  from ....lib.sparse import issparse, SparseNDArray
  from ....utils import ignore_warning
  from ...datasource import tensor, diag, ones, arange
  from ...random import uniform
  from ..None import qr, svd, cholesky, norm, lu, solve_triangular, solve, inv, tensordot, dot, inner, vdot, matmul, randomized_svd
label_desc: Use image node_id 5 for calling a global function with example usage: test_lu_execution(setup) without return types