lundi 8 août 2022

How to ensure that all rows or columns are shifted while shuffling the tensor?

Now I need to randomize an existing tensor of m*m and make sure all rows or columns will not stay in the original position, the shuffle() function provided by python can only achieve the randomization function, but can not guarantee that all elements are moved. Alternatively, a diagonal matrix can be randomly disordered to ensure that there are no zeros on the diagonal and that element 1 appears only once in each row and column, and multiplying this matrix with the original matrix will also achieve the above function, but how to generate such a matrix is also a problem. If anyone knows how to solve this problem, please reply to me, I would be very grateful!




Aucun commentaire:

Enregistrer un commentaire