since the final sweep will not actually perform any rotations within the SVD of $G$. The entire batched operation will then converge when $e = \max e_l < \epsilon$, where $\epsilon$ is our convergence tolerance. This gives us the Gram matrix path of the batched block Jacobi Algorithm \[alg:block\_jacobi\] to compute the SVD of a batch of matrices in global memory. It is worth noting that the computation of the Gram matrix can be optimized by taking advantage of the special structure of $G$, but since the bulk of the computation is in the SVD of G, it will not result in any significant performance gains.

Direct Block Jacobi SVD
-----------------------

The Gram matrix method is an indirect way of orthogonalizing block columns and may fail to converge if the matrix is very ill-conditioned. Ill-conditioned matrices can be handled by directly orthogonalizing the columns using their SVD. Since the block columns are rectangular, we first compute their QR decomposition followed by the SVD of the triangular factor $R$. Overwriting the block column $A^p_{ij}$ by the orthogonal factor $Q$ and multiplying it by the left singular vectors of $R$ scaled by the singular values will give us the new block column 