Factorization of Matrix and Operator Functions: The State Space Method