I'm applying a calculation to a block from a 6x6 matrix. I get the block by using Part
. For example:
kept={1, 2, 4, 5, 6}
KBB=mk[[kept,kept]]
where mk
is my 6x6 matrix. So the above code, basically removes row 3 and column 3 and puts into KBB
the resulting 5x5 matrix.
Then I apply several calculations to KBB
and, at the end, I want to "undo" the work done by Part.
So, now I want to "send" the rows and columns from KBB
back to a new 6x6 matrix, at positions {1, 2, 4, 5, 6}
while filling any undefined row/columns with zeroes (in this example, the third row and column should be all zeroes in the result).
Note that this example only removes one row and column, but it could be two, three, four, or five.
I mean, I need to apply this transformation to very different cases such as:
kept={1,2,3,5}
kept={1,3,5}
kept={6}
In all cases, the final matrix must be again 6x6, just like the original one.
Isn't there any opposite of Part
? Any sort of row/column remapping command?