What are going to do with
mymatrix[index1][index2]
? Is it just a value or you intend to access mymatrix
internals? Consider to return a wrapper from indexer, which takes current main instance and extend it with needed functionality, e.g. matrix[i] -> row, row[i] -> cell, etc.