You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right multiplication of a matrix by a permutation permutes the columns of said matrix. The permutation that is performed however, corresponds to the transpose (inverse) of the permutation matrix, which leads to unexpected results. Consider the simple sample program:
externcrate rulinalg;fnmain(){let p = rulinalg::matrix::PermutationMatrix::from_array(vec![1,2,0]).unwrap();let i = rulinalg::matrix::Matrix::<u32>::identity(3);println!("p.as_matrix() =\n{}", p.as_matrix());println!("p*i =\n{}",&p *&i);println!("i*p =\n{}",&i *&p);}
So left multiplying the identity matrix by a permutation gives its matrix representation (as per as_matrix()), but right multiplication results in the transpose matrix.
I can see how this happens (the same permutation is simply applied to the columns when right-multiplying), but for matrix multiplication this is not what I would expect.
The text was updated successfully, but these errors were encountered:
Right multiplication of a matrix by a permutation permutes the columns of said matrix. The permutation that is performed however, corresponds to the transpose (inverse) of the permutation matrix, which leads to unexpected results. Consider the simple sample program:
The output of this program is
So left multiplying the identity matrix by a permutation gives its matrix representation (as per
as_matrix()
), but right multiplication results in the transpose matrix.I can see how this happens (the same permutation is simply applied to the columns when right-multiplying), but for matrix multiplication this is not what I would expect.
The text was updated successfully, but these errors were encountered: