(49G) Permutation List 2 Permutation Matrix

05302015, 07:04 AM
(This post was last modified: 06152017 01:44 PM by Gene.)
Post: #1




(49G) Permutation List 2 Permutation Matrix
Given a permutation list as input, eg
{ 4 3 1 2 6 5 } the programme returns the corresponding permutation matrix, in this case [[ 0 0 0 1 0 0 ] [ 0 0 1 0 0 0 ] [ 1 0 0 0 0 0 ] [ 0 1 0 0 0 0 ] [ 0 0 0 0 0 1 ] [ 0 0 0 0 1 0 ]]. As a check, applying the matrix to [[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ]] returns [[ 4 ] [ 3 ] [ 1 ] [ 2 ] [ 6 ] [ 5 ]]. Code: :: 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)