Dot optimization

This is a generalization of the proposed optimization T.dot(A, B)[i] --> T.dot(A[i], B) to deal with multiple indices. For example, if A and B are matrices then T.dot(A, B)[:, i] will become T.dot(A, B[:, i]), and similarly for tensors and more indices. The tests have not yet been written.
well, if T.dot(A, B)[idxs] = T.dot(A[idxs_a], B[idxs_b]), then idxs_b is the remaining indices from idxs, but with an extra empty slice inserted, i.e. idxs_b_new = idx_b_old[:B.ndim-1] + [:] + idx_b_old[B.ndim-1:]. I updated the text to try to be more clear.