Update matrix.cpp