Mathematica Asked by mathisfun_ on July 5, 2021
I want to permute a matrix based on some permutation cycle which is not known beforehand. A function searches through the matrix and returns the pair of indices $i,j$ of the first entry which equals some specific value. Now, I want to permute the matrix such that that column $j$ appears first in the matrix. I would use the function Cycles[{{1,j}}]
, but it doesn’t work if the index $j$ equals 1 (since I want to bring it to the first column).
Is there a way to create a general permutation function such that in the situation that $j=1$, it just returns the identity permutation (so it doesn’t permute the matrix)?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP