matrices: handle matrix wrapper preallocation