faster matrix update using scalar index
faster array update assignment