code: def matrix_to_array(matrix, order, allow_double_hack=False):
      if order.upper() == "C":
          h, w = matrix.shape
          stride = 0
      elif order.upper() == "F":
          w, h = matrix.shape
          stride = -1
      else:
          raise LogicError("order must be either F or C")
  
      matrix = np.asarray(matrix, order=order)
      descr = ArrayDescriptor()
  
      descr.width = w
      descr.height = h
  
      if matrix.dtype == np.float64 and allow_double_hack:
          descr.format = array_format.SIGNED_INT32
          descr.num_channels = 2
      else:
          descr.format = dtype_to_array_format(matrix.dtype)
          descr.num_channels = 1
  
      ary = Array(descr)
  
      copy = Memcpy2D()
      copy.set_src_host(matrix)
      copy.set_dst_array(ary)
      copy.width_in_bytes = (
          copy.src_pitch
      ) = copy.dst_pitch = matrix.strides[stride]
      copy.height = h
      copy(aligned=True)
  
      return ary
  
imports: import os
  import numpy
label_desc: Use image node_id 16 for calling a global function with example usage: matrix_to_array(matrix, order, allow_double_hack) and returns: ary