1
$\begingroup$

I want to calculate the number of unrepeated Jordan canonical forms of n * n matrices consisting of 0 and 1 How to speed up this code

sol4=Flatten[Inactive[Table][Table[x[(i-1) 4+j],{i,1,4},{j,1,4}],Sequence@@Table[{x[i],0,1},{i,1,16}]]//Activate,15];GatherBy[sol4,(JordanDecomposition[#1][[2]])&]//Length 
$\endgroup$

1 Answer 1

3
$\begingroup$

This took less than 3 minutes on my Quad Core machine:

A = Tuples[{0, 1}, {4, 4}];
data = ParallelMap[(JordanDecomposition[#1][[2]]) &, A]; // AbsoluteTiming // First
DeleteDuplicates[data] // Length

159.48

395

$\endgroup$
1
  • 1
    $\begingroup$ How can you speed up if you change it to a 6 * 6 matrix $\endgroup$ Commented Nov 23, 2019 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.