And now here is a version in row-major form