test code for incremental update of matrix