code: def sfqr(data, name=None):
      """Direct Short-and-Fat QR
  
      Currently, this is a quick hack for non-tall-and-skinny matrices which
      are one chunk tall and (unless they are one chunk wide) have chunks
      that are wider than they are tall
  
      Q [R_1 R_2 ...] = [A_1 A_2 ...]
  
      it computes the factorization Q R_1 = A_1, then computes the other
      R_k's in parallel.
  
      Parameters
      ----------
      data: Array
  
      See Also
      --------
      dask.array.linalg.qr
          Main user API that uses this function
      dask.array.linalg.tsqr
          Variant for tall-and-skinny case
      """
      nr, nc = len(data.chunks[0]), len(data.chunks[1])
      cr, cc = data.chunks[0][0], data.chunks[1][0]
  
      if not (
          (data.ndim == 2)
          and (nr == 1)  # Is a matrix
          and (  # Has exactly one block row
              (cr <= cc)
              or (
                  nc == 1
              )  # Chunking dimension on rows is at least that on cols or...
          )
      ):  # ... only one block col
          raise ValueError(
              "Input must have the following properties:\n"
              "  1. Have two dimensions\n"
              "  2. Have only one row of blocks\n"
              "  3. Either one column of blocks or (first) chunk size on cols\n"
              "     is at most that on rows (e.g.: for a 5x20 matrix,\n"
              "     chunks=((5), (8,4,8)) is fine, but chunks=((5), (4,8,8)) is not;\n"
              "     still, prefer something simple like chunks=(5,10) or chunks=5)\n\n"
              "Note: This function (sfqr) supports QR decomposition in the case\n"
              "of short-and-fat matrices (single row chunk/block; see qr)"
          )
  
      prefix = name or "sfqr-" + tokenize(data)
      prefix += "_"
  
      m, n = data.shape
  
      qq, rr = np.linalg.qr(np.ones(shape=(1, 1), dtype=data.dtype))
  
      layers = data.__dask_graph__().layers.copy()
      dependencies = data.__dask_graph__().dependencies.copy()
  
      # data = A = [A_1 A_rest]
      name_A_1 = prefix + "A_1"
      name_A_rest = prefix + "A_rest"
      layers[name_A_1] = {(name_A_1, 0, 0): (data.name, 0, 0)}
      dependencies[name_A_1] = set(data.__dask_layers__())
      layers[name_A_rest] = {
          (name_A_rest, 0, idx): (data.name, 0, 1 + idx)
          for idx in range(nc - 1)
      }
      if len(layers[name_A_rest]) > 0:
          dependencies[name_A_rest] = set(data.__dask_layers__())
      else:
          dependencies[name_A_rest] = set()
  
      # Q R_1 = A_1
      name_Q_R1 = prefix + "Q_R_1"
      name_Q = prefix + "Q"
      name_R_1 = prefix + "R_1"
      layers[name_Q_R1] = {
          (name_Q_R1, 0, 0): (np.linalg.qr, (name_A_1, 0, 0))
      }
      dependencies[name_Q_R1] = {name_A_1}
  
      layers[name_Q] = {
          (name_Q, 0, 0): (operator.getitem, (name_Q_R1, 0, 0), 0)
      }
      dependencies[name_Q] = {name_Q_R1}
  
      layers[name_R_1] = {
          (name_R_1, 0, 0): (operator.getitem, (name_Q_R1, 0, 0), 1)
      }
      dependencies[name_R_1] = {name_Q_R1}
  
      graph = HighLevelGraph(layers, dependencies)
  
      Q_meta = meta_from_array(
          data, len((m, min(m, n))), dtype=qq.dtype
      )
      R_1_meta = meta_from_array(
          data, len((min(m, n), cc)), dtype=rr.dtype
      )
      Q = Array(
          graph,
          name_Q,
          shape=(m, min(m, n)),
          chunks=(m, min(m, n)),
          meta=Q_meta,
      )
      R_1 = Array(
          graph,
          name_R_1,
          shape=(min(m, n), cc),
          chunks=(cr, cc),
          meta=R_1_meta,
      )
  
      # R = [R_1 Q'A_rest]
      Rs = [R_1]
  
      if nc > 1:
          A_rest_meta = meta_from_array(
              data, len((min(m, n), n - cc)), dtype=rr.dtype
          )
          A_rest = Array(
              graph,
              name_A_rest,
              shape=(min(m, n), n - cc),
              chunks=(cr, data.chunks[1][1:]),
              meta=A_rest_meta,
          )
          Rs.append(Q.T.dot(A_rest))
  
      R = concatenate(Rs, axis=1)
  
      return Q, R
  
imports: from __future__ import annotations
  import operator
  import warnings
  from functools import partial
  from numbers import Number
  import numpy
  import tlz
  from dask.array.core import Array, concatenate, dotmany, from_delayed
  from dask.array.creation import eye
  from dask.array.random import RandomState, default_rng
  from dask.array.utils import array_safe, meta_from_array, solve_triangular_safe, svd_flip
  from dask.base import tokenize, wait
  from dask.blockwise import blockwise
  from dask.delayed import delayed
  from dask.highlevelgraph import HighLevelGraph
  from dask.utils import apply, derived_from
label_desc: Use image node_id 6 for calling a global function with example usage: sfqr(data, name) and returns: Q,  R