matrix element increment func