@wenqing Maybe I got not the point of your statement or my previous statement was not clear enough? I want to change the two inner  loops (loop counter i_r and j_x). My hope is to improve the access pattern to the matrices ```shapemat.J``` and ```spapemat.dNdr```.