# Dense and sparse matrix slicing based on input user defined indices

This should allow functionality similar to MATLAB:

Suppose that A is the following matrix

A = [ 10 20 30 40 ;

```
11 21 31 41;
```

12 22 32 42;

13 23 33 43]

and I = { 1, 2, 4 } and J = { 3, 4 }

A_IJ = A[I, J]

should return a slice of the matrix according to the indices specified:

A_IJ = [ 30 40;

```
31 41;
```

33 43 ]

The same idea is very useful for arrays and it should work in both directions, for example:

A[I, J] += some*3by2*matrix;

The same for sparse matrices.

The functionality for sparse matrices will allow you to implement without agonizing pain the function minimization algorithms and the Quadratic programming solvers, because the KKT system you need to solve at each iteration is a block matrix, where each block is a sparse matrix. Also that functionality will allow you easy maintenance of C# and MATLAB codes because the core numerical procedures will look very similar.

**0**votes