Apply algorith 2 in https://arxiv.org/pdf/1901.08910.pdf.

  Args:
    usv: matrix to reduce given in SVD form with the spectrum s in
      increasing order.
    num_rows: number of rows in the output matrix.
    num_cols: number of columns in the output matrix.
  Returns:
    A resized version of (u, s, v) whose non zero singular values will be
      identical to the largest singular values in s.

def resize_matrix(usv, num_rows, num_cols):
  """Apply algorith 2 in https://arxiv.org/pdf/1901.08910.pdf.

  Args:
    usv: matrix to reduce given in SVD form with the spectrum s in
      increasing order.
    num_rows: number of rows in the output matrix.
    num_cols: number of columns in the output matrix.
  Returns:
    A resized version of (u, s, v) whose non zero singular values will be
      identical to the largest singular values in s.
  """
  u, s, v = usv
  k = min(num_rows, num_cols)

  u_random_proj = transform.resize(u[:, :k], (num_rows, k))
  v_random_proj = transform.resize(v[:k, :], (k, num_cols))

  u_random_proj_orth = _closest_column_orthogonal_matrix(u_random_proj)
  v_random_proj_orth = _closest_column_orthogonal_matrix(v_random_proj.T).T

  return np.matmul(u_random_proj_orth,
                   np.matmul(np.diag(s[::-1][:k]), v_random_proj_orth))