code: def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
      """
      Make a nested loop over several arrays and associate specific code
      to each level of nesting.
  
      Parameters
      ----------
      loop_orders : list of N tuples of length M
          Each value of each tuple can be either the index of a dimension to
          loop over or the letter 'x' which means there is no looping to be done
          over that variable at that point (in other words we broadcast
          over that dimension). If an entry is an integer, it will become
          an alias of the entry of that rank.
      loop_tasks : list of M+1 pieces of code
          The ith loop_task is a pair of strings, the first
          string is code to be executed before the ith loop starts, the second
          one contains code to be executed just before going to the next element
          of the ith dimension.
          The last element if loop_tasks is a single string, containing code
          to be executed at the very end.
      sub : dictionary
          Maps 'lv#' to a suitable variable name.
          The 'lvi' variable corresponds to the ith element of loop_orders.
  
      """
  
      def loop_over(preloop, code, indices, i):
          iterv = "ITER_%i" % i
          update = ""
          suitable_n = "1"
          for j, index in enumerate(indices):
              var = sub["lv%i" % j]
              dtype = dtypes[j]
              update += (
                  "%(dtype)s &%(var)s_i = * ( %(var)s_iter + %(iterv)s * %(var)s_jump%(index)s_%(i)s );\n"
                  % locals()
              )
              if index != "x":
                  suitable_n = "%(var)s_n%(index)s" % locals()
          if openmp:
              openmp_elemwise_minsize = (
                  theano.config.openmp_elemwise_minsize
              )
              forloop = (
                  """#pragma omp parallel for if( %(suitable_n)s >=%(openmp_elemwise_minsize)s)\n"""
                  % locals()
              )
          else:
              forloop = ""
          forloop += (
              """for (int %(iterv)s = 0; %(iterv)s<%(suitable_n)s; %(iterv)s++)"""
              % locals()
          )
          return (
              """
          %(preloop)s
          %(forloop)s {
              %(update)s
              %(code)s
          }
          """
              % locals()
          )
  
      preloops = {}
      for i, (loop_order, dtype) in enumerate(zip(loop_orders, dtypes)):
          for j, index in enumerate(loop_order):
              if index != "x":
                  preloops.setdefault(j, "")
                  preloops[j] += (
                      "%%(lv%(i)s)s_iter = (%(dtype)s*)(PyArray_DATA(%%(lv%(i)s)s));\n"
                      % locals()
                  ) % sub
                  break
          else:  # all broadcastable
              preloops.setdefault(0, "")
              preloops[0] += (
                  "%%(lv%(i)s)s_iter = (%(dtype)s*)(PyArray_DATA(%%(lv%(i)s)s));\n"
                  % locals()
              ) % sub
  
      s = ""
  
      for i, (pre_task, task), indices in reversed(
          list(
              zip(
                  xrange(len(loop_tasks) - 1),
                  loop_tasks,
                  list(zip(*loop_orders)),
              )
          )
      ):
          s = loop_over(
              preloops.get(i, "") + pre_task, s + task, indices, i
          )
  
      s += loop_tasks[-1]
      return "{%s}" % s
  
file_path: Theano/theano/tensor/elemwise_cgen.py
imports: from __future__ import absolute_import, print_function, division
  from six.moves import xrange
  import theano
label_desc: Use image node_id 4 for calling a global function with example usage: make_loop(loop_orders, dtypes, loop_tasks, sub, openmp) and returns: unknown, unknown