code: def _make_tsm(
      entry_expr,
      block_size,
      *,
      partition_size=None,
      whiten_window_size=None,
      whiten_block_size=64,
      normalize_after_whiten=False,
  ):
      mt = matrix_table_source("_make_tsm/entry_expr", entry_expr)
  
      if whiten_window_size is None:
          A, ht = mt_to_table_of_ndarray(
              entry_expr,
              block_size,
              return_checkpointed_table_also=True,
          )
          return TallSkinnyMatrix(A, A.ndarray, ht, list(mt.col_key))
      else:
          # FIXME: don't whiten across chromosome boundaries
          A, trailing_blocks_ht, ht = mt_to_table_of_ndarray(
              entry_expr,
              block_size,
              return_checkpointed_table_also=True,
              partition_size=partition_size,
              window_size=whiten_window_size,
          )
  
          A = A.annotate(ndarray=A.ndarray.T)
          vec_size = hl.eval(ht.take(1, _localize=False)[0].xs.length())
          if vec_size <= whiten_window_size:
              raise ValueError(
                  "whiten_window_size must be smaller than number of cols"
              )
          joined = A.annotate(
              prev_window=trailing_blocks_ht[A.key].prev_window
          )
  
          def whiten_map_body(part_stream):
              stream_ir = ir.StreamWhiten(
                  part_stream._ir,
                  "ndarray",
                  "prev_window",
                  vec_size,
                  whiten_window_size,
                  block_size,
                  whiten_block_size,
                  normalize_after_whiten,
              )
              return construct_expr(stream_ir, part_stream.dtype)
  
          whitened = joined._map_partitions(whiten_map_body)
          whitened = whitened.annotate(
              ndarray=whitened.ndarray.T
          ).persist()
  
          return TallSkinnyMatrix(
              whitened, whitened.ndarray, ht, list(mt.col_key)
          )
  
imports: from typing import List, Tuple
  import hail
  import hail.expr.aggregators
  from hail.expr.expressions import construct_expr
  from hail.expr import expr_float64, expr_call, raise_unless_entry_indexed, matrix_table_source
  from hail import ir
  from hail.table import Table
  from hail.typecheck import typecheck, oneof, nullable
  from hail.utils import FatalError
  from hail.utils.java import Env, info
  from hail.experimental import mt_to_table_of_ndarray
label_desc: Use image node_id 4 for calling a global function with example usage: _make_tsm(entry_expr, block_size) and returns: TallSkinnyMatrix, TallSkinnyMatrix, construct_expr