converter matrix from file into 1-D array
fix of distance calculations
handwriting test