Implemented Matrix mean