Invariant factors and generalized Schur matrices