ij2k function

Convert an (i, j) index to a linear index.