added a new function to matrix