Issue 3656: Implementation of fancy indexing in matrix