Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 2
    $\begingroup$ To make the before/after comparison more effective you can include timing information from AbsoluteTiming. Also, include the output of $Version to your post. What type of entries does emat have? Please include emat and UV. In short, please present a minimal example and include definitions. $\endgroup$ Commented Mar 31, 2023 at 6:11
  • 1
    $\begingroup$ @Syed Thanks for pointing out those. I edited my post. $\endgroup$ Commented Mar 31, 2023 at 6:38
  • 1
    $\begingroup$ You are recomputing IntegrateUnitaryHaar[UV.emat[[j]].ConjugateTranspose[UV],{u,15},{v,1}] for every value of i instead of memoizing it. $\endgroup$ Commented Mar 31, 2023 at 8:07
  • 1
    $\begingroup$ Use sparse Pauli matrices for speed: Clear[σ, emat]; σ[i_] := σ[i] = SparseArray[PauliMatrix[i]]; emat[i_Integer, j_Integer, k_Integer, l_Integer] := emat[i, j, k, l] = KroneckerProduct[σ[i], σ[j], σ[k], σ[l]] will give you memoized, sparse, quick access to the emat values without forcing a pre-compute. $\endgroup$ Commented Mar 31, 2023 at 8:08
  • $\begingroup$ Can you please edit your post so that the code can be copy-pasted into a notebook and will actually run? Please don't expect people to piece it together by themselves. $\endgroup$ Commented Mar 31, 2023 at 8:19