I have a function in F# that i would like for it to create a square sub-matrix from just a square matrix. What i need to be able to do is remove a row and column from the original matrix and transform it into a sub matrix. This is what i tried so far:
/// <param name="A">An N-by-N matrix.</param>
/// <param name="i">The index of the row to remove.</param>
/// <param name="j">The index of the column to remove.</param>
/// <returns>The resulting (N - 1)-by-(N - 1) submatrix.</returns>
static member SquareSubMatrix (A : Matrix) (i : int) (j : int) : Matrix =
let m_rows = A.M_Rows
let n_cols = A.N_Cols
let toarr = A.ToArray()
let retval = toarr.[0..m_rows-1,0..n_cols-1]
Matrix retval
The M_Rows and N_Cols is just custom function to get the number of rows and columns a matrix has, and the ToArray function is just as the name says.
So i've tried converting the matrix into an array so i can slice it, and then convert it back but im not sure how i can slice out a specific row/column from the array. The code above just returns the input matrix because it doesnt slice anything cause im not sure how to do it.