Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. n = 1000000;
  2. u = RandomPoint[Sphere[{0, 0, 0}], 3];
  3.  
  4. cf = Block[{u, dim},
  5. dim = 3;
  6. With[{code = KroneckerProduct[#, #] &[ Table[Compile`GetElement[u, i], {i, 1, dim}]]},
  7. Compile[{{u, _Real, 1}},
  8. code,
  9. CompilationTarget -> "C",
  10. RuntimeAttributes -> {Listable},
  11. Parallelization -> True,
  12. RuntimeOptions -> "Speed"
  13. ]
  14. ]
  15. ];
  16.  
  17. Q = 0.5 (Mean[cf[u]] - IdentityMatrix[3]);
  18. p = Eigenvalues[Q, {3}][[1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement