code: def test_solve_triangular(setup):
      from ... import tril, triu
  
      rs = np.random.RandomState(0)
  
      data1 = rs.randint(1, 10, (20, 20))
      data2 = rs.randint(1, 10, (20,))
  
      A = tensor(data1, chunk_size=20)
      b = tensor(data2, chunk_size=20)
  
      x = solve_triangular(A, b)
      t = triu(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      x = solve_triangular(A, b, lower=True)
      t = tril(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      A = tensor(data1, chunk_size=10)
      b = tensor(data2, chunk_size=10)
  
      x = solve_triangular(A, b)
      t = triu(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      x = solve_triangular(A, b, lower=True)
      t = tril(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      data1 = rs.randint(1, 10, (10, 10))
      data2 = rs.randint(1, 10, (10, 5))
  
      A = tensor(data1, chunk_size=10)
      b = tensor(data2, chunk_size=10)
  
      x = solve_triangular(A, b)
      t = triu(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      x = solve_triangular(A, b, lower=True)
      t = tril(A).dot(x)
  
      res = t.execute().fetch()
      np.testing.assert_allclose(res, data2)
  
      # test sparse
      data1 = sps.csr_matrix(np.triu(rs.randint(1, 10, (10, 10))))
      data2 = rs.random((10,))
  
      A = tensor(data1, chunk_size=5)
      b = tensor(data2, chunk_size=5)
  
      x = solve_triangular(A, b)
  
      result_x = x.execute().fetch()
      result_b = data1.dot(result_x)
  
      assert isinstance(result_x, SparseNDArray)
      np.testing.assert_allclose(result_b, data2)
  
      data1 = sps.csr_matrix(np.triu(rs.randint(1, 10, (10, 10))))
      data2 = rs.random((10, 2))
  
      A = tensor(data1, chunk_size=5)
      b = tensor(data2, chunk_size=5)
  
      x = solve_triangular(A, b)
  
      result_x = x.execute().fetch()
      result_b = data1.dot(result_x)
  
      assert isinstance(result_x, SparseNDArray)
      np.testing.assert_allclose(result_b, data2)
  
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 6 for calling a global function with example usage: test_solve_triangular(setup) without return types