i -> row, j -> column
change TypeError to RuntimeError
add test with a 1xn rectangular matrix