An easy way to remove a matrix column in Mathematica

I am trying to remove as a matrix in math. Inelegant way to do this, as I do below, that is, specify it in the new matrix as

S = Table[ Ss[[If[i < t, i, i + 1]]][[If[j < t, j, j + 1]]], {i, q}, {j, q}]; 

where the goal is to exclude row and column t.

Really deleting a line is easy to Delete [Ss, t]. For column column, I suppose I could do

 Transpose[Delete[Transpose[Ss,t]]] 

My main task is to do it in such a way as to perform the fastest way.

More generally, is there a Mathematica operator that makes it as easy to cut into columns of a matrix as it does for rows without resorting to transposition?

+7
source share
1 answer

I think you are looking for:

 Drop[Ss,{t},{t}] 

Dates:

 ClearAll["Global`*"]; First@Timing [a = RandomInteger[1000, {5000, 5000}];] 0.34 First@Timing [Drop[a, {2}, {2}]] 0.11 

While

 First@Timing [ Transpose@Delete [ Transpose@Delete [a, 2], 2]] 0.5 
+13
source

All Articles