change Q to row major (make coordinate step more efficient)