Sanity checking for matrix entry.