  We develop an equivalence between two Hilbert spaces: (i) the space of states
of $U(1)^n$ Chern-Simons theory with a certain class of tridiagonal matrices of
coupling constants (with corners) on $T^2$; and (ii) the space of ground states
of strings on an associated mapping torus with $T^2$ fiber. The equivalence is
deduced by studying the space of ground states of $SL(2,Z)$-twisted circle
compactifications of $U(1)$ gauge theory, connected with a Janus configuration,
and further compactified on $T^2$. The equality of dimensions of the two
Hilbert spaces (i) and (ii) is equivalent to a known identity on determinants
of tridiagonal matrices with corners. The equivalence of operator algebras
acting on the two Hilbert spaces follows from a relation between the Smith
normal form of the Chern-Simons coupling constant matrix and the isometry group
of the mapping torus, as well as the torsion part of its first homology group.
