Abstract. -The theory of almost commuting matrices can be used to quantify topological obstructions to the existence of localized Wannier functions with time-reversal symmetry in systems with time-reversal symmetry and strong spin-orbit coupling. We present a numerical procedure that calculates a Z2 invariant using these techniques, and apply it to a model of HgTe. This numerical procedure allows us to access sizes significantly larger than procedures based on studying twisted boundary conditions. Our numerical results indicate the existence of a metallic phase in the presence of scattering between up and down spin components, while there is a sharp transition when the system decouples into two copies of the quantum Hall effect. In addition to the Z2 invariant calculation in the case when up and down components are coupled, we also present a simple method of evaluating the integer invariant in the quantum Hall case where they are decoupled.The study of topological insulators is one of the most active areas of physics today. Experimental and theoretical work has shown physical realizations of time-reversal invariant insulators with strong spin-orbit coupling in both two [1] and three dimensions [2] and a complete classification of different insulating phases has been recently obtained using methods of Anderson localization [3] and, more generally, K-theoretic techniques [4].However, numerically it is difficult to determine the Z 2 invariants that are signatures of topological insulating phases. For systems with translational invariance, one can study the bundle over the momentum torus [5], while for systems without translation invariance, Essin and Moore [6] were able to study the phase diagram of a graphene model by studying the model over a flux torus corresponding to twisted boundary conditions. Unfortunately, the flux torus approach is very computationally intensive: for each disorder realization, the Hamiltonian must be diagonalized once for each point on a discrete grid on the flux torus, and then the connection on the torus must be computed. This limited the study to small systems, with at most 64 sites.In this paper, we present a different approach to calculating a Z 2 invariant, based on ideas in C * -algebras, in particular the K-theory of almost commuting matrices. We present a fast numerical algorithm based on these ideas. Computing the invariant requires a single diagonalization of the Hamiltonian, matrix function calculations on matrices at most half the size of the Hamiltonian, and finally the calculation of the Pfaffian of a real anti-symmetric matrix that is at most the size of the Hamiltonian. The most costly step is a single diagonalization, allowing us to study significantly larger samples, up to 1600 sites.Our invariant serves the same fundamental purpose as the invariant used in [6]-proving that for certain lowenergy bands it is impossible to find well-localized Wannier functions with time-reversal symmetry. These invariants are most likely equivalent, but that is another topic [7].We apply ...