Speed up matrix element access by storing last access position.

This should speed up normal element access if the elements are accessed
in sequential order.

Change-Id: Ia5c688ed79aabbc1fdcfc4dd5bf4b25359a585d5