code: def test_arrayexpr_convert_indexed_to_array_and_back_to_matrix():
      expr = a.T * b
      elem = expr[0, 0]
      cg = convert_indexed_to_array(elem)
      assert cg == ArrayElement(
          ArrayContraction(ArrayTensorProduct(a, b), (0, 2)), [0, 0]
      )
  
      expr = M[i, j] + N[i, j]
      p1, p2 = _convert_indexed_to_array(expr)
      assert convert_array_to_matrix(p1) == M + N
  
      expr = M[i, j] + N[j, i]
      p1, p2 = _convert_indexed_to_array(expr)
      assert convert_array_to_matrix(p1) == M + N.T
  
      expr = M[i, j] * N[k, l] + N[i, j] * M[k, l]
      p1, p2 = _convert_indexed_to_array(expr)
      assert convert_array_to_matrix(p1) == ArrayAdd(
          ArrayTensorProduct(M, N), ArrayTensorProduct(N, M)
      )
  
      expr = (M * N * P)[i, j]
      p1, p2 = _convert_indexed_to_array(expr)
      assert convert_array_to_matrix(p1) == M * N * P
  
      expr = Sum(M[i, j] * (N * P)[j, m], (j, 0, k - 1))
      p1, p2 = _convert_indexed_to_array(expr)
      assert convert_array_to_matrix(p1) == M * N * P
  
      expr = Sum(
          (P[j, m] + P[m, j]) * (M[i, j] * N[m, n] + N[i, j] * M[m, n]),
          (j, 0, k - 1),
          (m, 0, k - 1),
      )
      p1, p2 = _convert_indexed_to_array(expr)
      assert (
          convert_array_to_matrix(p1)
          == M * P * N + M * P.T * N + N * P * M + N * P.T * M
      )
  
file_path: sympy/sympy/tensor/array/expressions/tests/test_convert_indexed_to_array.py
imports: from sympy import tanh
  from sympy.concrete.summations import Sum
  from sympy.core.symbol import symbols
  from sympy.functions.special.tensor_functions import KroneckerDelta
  from sympy.matrices.expressions.matexpr import MatrixSymbol
  from sympy.matrices.expressions.special import Identity
  from sympy.tensor.array.expressions import ArrayElementwiseApplyFunc
  from sympy.tensor.indexed import IndexedBase
  from sympy.combinatorics import Permutation
  from sympy.tensor.array.expressions.array_expressions import ArrayContraction, ArrayTensorProduct, ArrayDiagonal, ArrayAdd, PermuteDims, ArrayElement, _array_tensor_product, _array_contraction, _array_diagonal, _array_add, _permute_dims, ArraySymbol, OneArray
  from sympy.tensor.array.expressions.from_array_to_matrix import convert_array_to_matrix
  from sympy.tensor.array.expressions.from_indexed_to_array import convert_indexed_to_array, _convert_indexed_to_array
  from sympy.testing.pytest import raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_arrayexpr_convert_indexed_to_array_and_back_to_matrix() without return types