PastaQ.jl
PastaQ.jl copied to clipboard
Fixed fulltomography
Motivation:
I wanted to tomograph and reconstruct a state from the output from a quantum circuit I had implemented in PastaQ, but I kept getting Error: 'empirical_probabilities' is not defined. This led me to explore the project code, and I ended up making the functionality work. I have added my changes as a PR.
Small changes to some files in the project, I have added a list here:
- Added
.vscodeto.gitignore. This is mainly for cleanup. :) - Added entries for Convex, SCS, and MathOptInterface to Manifest. This enables us to unconditionally include
fulltomography.jlin the module. - Tiny correction to the README, just ensuring consistency (everything that's part of code, including the
]to go into package mode, is formatted as code instead of regular text) - Moved
fulltomography.jlinto the module proper, removed the requirement for optionalSCSandConvex, and made them as required dependencies. fulltomography.jlnow importsSCS,Convex, andMathOptInterfaceseparately. The earlier importconst MOI = SCS.MathOptInterfacewould throw an error.- The functions in
fulltomography.jlhad some inconsistent implementations for the maximum likelihood keyword, fixed everything to be consistent. - Modified
runtests.jlto use afilter, not an explicit list of tests. This can later be upgraded to broadcast the logical&&operation on the array returned fromreaddir(), but requires >=Julia v1.7. - Modified
test_fulltomography.jlto use the new keyword for maximum likelihood. - Modified
test_gpu.jlto add Phase damping noise as well, and create a newtestsetfor depolarizing noise. This takes care of the fact that even ifeltypeisnothing, the output ofruncircuitin case of depolarizing noise is aComplexF64, not aFloat64. - Modified
test_io.jlto write test output data to adata/subdirectory in thetestsfolder, so output of testing can be kept separately, keeping the code directory clean. Currently, this directory is added in the .gitignore, but can be removed in case test outputs are needed here. - Verified that all tests pass (at least with single threaded execution, yet to test multithreaded execution).
I would prefer to keep them as optional dependencies instead of direct dependencies. Ideally we would organize the code as a package extension: https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions).