code: def test_lu():
      a = mt.random.randint(1, 10, (6, 6), chunk_size=3)
      p, l_, u = mt.linalg.lu(a)
  
      p, l_, u = tile(p, l_, u)
  
      assert l_.shape == (6, 6)
      assert u.shape == (6, 6)
      assert p.shape == (6, 6)
  
      a = mt.random.randint(1, 10, (6, 6), chunk_size=(3, 2))
      p, l_, u = mt.linalg.lu(a)
      p, l_, u = tile(p, l_, u)
  
      assert l_.shape == (6, 6)
      assert u.shape == (6, 6)
      assert p.shape == (6, 6)
  
      assert p.nsplits == ((3, 3), (3, 3))
      assert l_.nsplits == ((3, 3), (3, 3))
      assert u.nsplits == ((3, 3), (3, 3))
  
      a = mt.random.randint(1, 10, (7, 7), chunk_size=4)
      p, l_, u = mt.linalg.lu(a)
      p, l_, u = tile(p, l_, u)
  
      assert l_.shape == (7, 7)
      assert u.shape == (7, 7)
      assert p.shape == (7, 7)
  
      assert p.nsplits == ((4, 3), (4, 3))
      assert l_.nsplits == ((4, 3), (4, 3))
      assert u.nsplits == ((4, 3), (4, 3))
  
      a = mt.random.randint(1, 10, (7, 5), chunk_size=4)
      p, l_, u = mt.linalg.lu(a)
      p, l_, u = tile(p, l_, u)
  
      assert l_.shape == (7, 5)
      assert u.shape == (5, 5)
      assert p.shape == (7, 7)
  
      a = mt.random.randint(1, 10, (5, 7), chunk_size=4)
      p, l_, u = mt.linalg.lu(a)
      p, l_, u = tile(p, l_, u)
  
      assert l_.shape == (5, 5)
      assert u.shape == (5, 7)
      assert p.shape == (5, 5)
  
      # test 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],
          ]
      )
      t = mt.tensor(data, chunk_size=3)
      p, l_, u = mt.linalg.lu(t)
  
      assert p.op.sparse is True
      assert isinstance(p, SparseTensor)
      assert l_.op.sparse is True
      assert isinstance(l_, SparseTensor)
      assert u.op.sparse is True
      assert isinstance(u, SparseTensor)
  
      p, l_, u = tile(p, l_, u)
  
      assert all(c.is_sparse() for c in p.chunks) is True
      assert all(c.is_sparse() for c in l_.chunks) is True
      assert all(c.is_sparse() for c in u.chunks) is True
  
file_path: mars/mars/tensor/linalg/tests/test_linalg.py
imports: import numpy
  import scipy.sparse
  import pytest
  from ....None import tensor
  from ....core import tile
  from ...None import ones, tensor, dot, empty
  from ...core import SparseTensor, Tensor
  from ..None import matmul
  from ..inv import TensorInv
label_desc: Use image node_id 4 for calling a global function with example usage: test_lu() without return types