added code to verify matrix results, and read input from a file for consistency