Overloaded the << operator for printing a dense matrix (replaces the print function).