can generate and print matrices perfectly