Updates matrix A