add high order function for matrix
refactor matrix poerators