Author Archives: Julia on EPH

Another example of using type domain information in Julia

By: Julia on EPH

Re-posted from: https://ericphanson.com/blog/2019/another-example-of-using-type-domain-information-in-julia/

In a previous post, I discussed using type domain information to speed up generation of random density matrices with small dimension in Julia. There, we gave the Julia compiler knowledge of the dimension of the matrices at the time it generates code, instead of passing that dimension as a runtime variable, and saw significant runtime speedups as a consequence. This time, let’s push this further by giving the compiler a whole vector of numbers instead of a single integer.

Fast small random density matrices

By: Julia on EPH

Re-posted from: https://ericphanson.com/blog/2018/fast-small-random-density-matrices/

Update (19 January 2019): I looked at this code again, and realized I had made a few basic mistakes, such as constructing a statically sized normally-distributed random matrix via SMatrix{d,d,Float64, d*d}(randn(Float64, d,d)) which constructs a random matrix (allocating memory dynamically) and then converts it to a static SMatrix, instead of randn(SMatrix{d,d,Float64}) which directly constructs an SMatrix without dynamic memory allocation. I also hadn’t written the function randsimplexpt in a very good way.