UCL-CCS / symmer

An efficient Python-based framework for implementing qubit subspace methods, reducing the resource requirements for near-term quantum simulations.
MIT License
37 stars 9 forks source link

Add optimized version of mpo construction for approximate tensor #148

Closed adilnaut closed 1 year ago

adilnaut commented 1 year ago

What I did:

Add optimized version of mpo construction for approximate tensor through direct construction of final mpo terms with Pauli strings positional groupings. i.e. Instead of iteratively constructing mpo for each Pauli string I groupped first, last and all the middles together and constructed lists with appropriate indexes for first and last terms, and diagonal matrix for middle terms and converted lists to numpy arrays. Where truncation to Dmax is made in the end once.

All tests for approximate tensor passed!

Preliminary results:

Results for Pauli strings array of length (N) 4 of each length (K) 13 - optimized version total test time for approximate_tensors elapsed in 26±0.2 seconds consitently against 43±0.2 seconds not-optimized (even when truncation is made only once in the end). For K=14, N=4 - 90s against 150s. Further increase in K or N resulted in process killed in MacBook Air M2 due to memory limits.

NB: The parallelization of middle terms loop had only worsen time elapsed possibly because of overhead of process comms - therefore I didn't include that in the pull request.

This is my final submission for UnitaryHack challenge issue #138