added equals method to matrix