class_docstr: Generate a list comprehension.
  
  Explanation
  ===========
  
  If there is a symbolic dimension, for example, say [i for i in range(1, N)] where
  N is a Symbol, then the expression will not be expanded to an array. Otherwise,
  calling the doit() function will launch the expansion.
  
  Examples
  ========
  
  >>> from sympy.tensor.array import ArrayComprehension
  >>> from sympy import symbols
  >>> i, j, k = symbols('i j k')
  >>> a = ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, 3))
  >>> a
  ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, 3))
  >>> a.doit()
  [[11, 12, 13], [21, 22, 23], [31, 32, 33], [41, 42, 43]]
  >>> b = ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, k))
  >>> b.doit()
  ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, k))
class_docstr_tok: ["Generate","a","list","comprehension",".","Explanation","===========","If","there","is","a","symbolic","dimension",",","for","example",",","say","[","i","for","i","in","range","(","1",",","N",")","]","where","N","is","a","Symbol",",","then","the","expression","will","not","be","expanded","to","an","array",".","Otherwise",",","calling","the","doit","(",")","function","will","launch","the","expansion",".","Examples","========",">",">",">","from","sympy.tensor.array","import","ArrayComprehension",">",">",">","from","sympy","import","symbols",">",">",">","i",",","j",",","k","=","symbols","(","'","i","j","k","'",")",">",">",">","a","=","ArrayComprehension","(","10","*","i","+","j",",","(","i",",","1",",","4",")",",","(","j",",","1",",","3",")",")",">",">",">","a","ArrayComprehension","(","10","*","i","+","j",",","(","i",",","1",",","4",")",",","(","j",",","1",",","3",")",")",">",">",">","a.doit","(",")","[","[","11",",","12",",","13","]",",","[","21",",","22",",","23","]",",","[","31",",","32",",","33","]",",","[","41",",","42",",","43","]","]",">",">",">","b","=","ArrayComprehension","(","10","*","i","+","j",",","(","i",",","1",",","4",")",",","(","j",",","1",",","k",")",")",">",">",">","b.doit","(",")","ArrayComprehension","(","10","*","i","+","j",",","(","i",",","1",",","4",")",",","(","j",",","1",",","k",")",")"]
docstr: Transform the expanded array to a matrix.
  
  Raises
  ======
  
  ValueError : When there is a symbolic dimension
  ValueError : When the rank of the expanded array is not equal to 2
  
  Examples
  ========
  
  >>> from sympy.tensor.array import ArrayComprehension
  >>> from sympy import symbols
  >>> i, j = symbols('i j')
  >>> a = ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, 3))
  >>> a.tomatrix()
  Matrix([
  [11, 12, 13],
  [21, 22, 23],
  [31, 32, 33],
  [41, 42, 43]])
docstr_tok: ["Transform","the","expanded","array","to","a","matrix",".","Raises","======","ValueError",":","When","there","is","a","symbolic","dimension","ValueError",":","When","the","rank","of","the","expanded","array","is","not","equal","to","2","Examples","========",">",">",">","from","sympy.tensor.array","import","ArrayComprehension",">",">",">","from","sympy","import","symbols",">",">",">","i",",","j","=","symbols","(","'","i","j","'",")",">",">",">","a","=","ArrayComprehension","(","10","*","i","+","j",",","(","i",",","1",",","4",")",",","(","j",",","1",",","3",")",")",">",">",">","a.tomatrix","(",")","Matrix","(","[","[","11",",","12",",","13","]",",","[","21",",","22",",","23","]",",","[","31",",","32",",","33","]",",","[","41",",","42",",","43","]","]",")"]
code: def tomatrix(self):
      """Transform the expanded array to a matrix.
  
      Raises
      ======
  
      ValueError : When there is a symbolic dimension
      ValueError : When the rank of the expanded array is not equal to 2
  
      Examples
      ========
  
      >>> from sympy.tensor.array import ArrayComprehension
      >>> from sympy import symbols
      >>> i, j = symbols('i j')
      >>> a = ArrayComprehension(10*i + j, (i, 1, 4), (j, 1, 3))
      >>> a.tomatrix()
      Matrix([
      [11, 12, 13],
      [21, 22, 23],
      [31, 32, 33],
      [41, 42, 43]])
      """
      from sympy.matrices import Matrix
  
      if not self.is_shape_numeric:
          raise ValueError(
              "A symbolic array cannot be expanded to a matrix"
          )
      if self._rank != 2:
          raise ValueError("Dimensions must be of size of 2")
  
      return Matrix(self._expand_array().tomatrix())
  
imports: import functools, itertools
  from sympy.core.sympify import _sympify, sympify
  from sympy.core.expr import Expr
  from sympy.core import Basic, Tuple
  from sympy.tensor.array import ImmutableDenseNDimArray
  from sympy.core.symbol import Symbol
  from sympy.core.numbers import Integer
label_desc: Use image node_id 18 for calling the ArrayComprehension obj's underlying member method code with example usage: obj.tomatrix() and returns: Matrix