Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = 1000000;
- u = RandomPoint[Sphere[{0, 0, 0}], 3];
- cf = Block[{u, dim},
- dim = 3;
- With[{code = KroneckerProduct[#, #] &[ Table[Compile`GetElement[u, i], {i, 1, dim}]]},
- Compile[{{u, _Real, 1}},
- code,
- CompilationTarget -> "C",
- RuntimeAttributes -> {Listable},
- Parallelization -> True,
- RuntimeOptions -> "Speed"
- ]
- ]
- ];
- Q = 0.5 (Mean[cf[u]] - IdentityMatrix[3]);
- p = Eigenvalues[Q, {3}][[1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement