This week was mostly about adding more benchmarks for toqito, but in the process I also uncovered a handful of inconsistencies and documentation gaps that could improve the library in general.

I spent most of the week writing offline (non-CI ready) benchmarks for toqito. While working on unique identification of runs last week, I realized that benchmark.extra_info could also be leveraged for ID-ing.

By the end of the week:

  • I had benchmarked 38 functions from toqito that have an overlap with qutipy

  • These benchmarks were spanned across 515 test cases, with main script (benchmark_toqito_offline.py, stored locally) now exceeding more than 1200 lines of code.

The full list of benchmarked functions is available here, though I am considering the idea of pushing the offline script to the repository as well for future use.

Since the script is already quite large, I’ll am considering about refactoring it into a modular structure to keep things scalable in future as toqito has 150+ functions!

Issues Discovered

While setting up benchmarks, I came across several points worth improving:

  • toqito.matrices.pauli returns an identity matrix for invalid indices instead of raising an error. Issue here.
  • toqito.perms.unvec could provide clearer error messages for invalid vector sizes.
  • toqito.perms.permutation_operator has docstring clarity issues (e.g., “full” vs “dense”), delayed validation, and a mismatch between the is_sparse flag and the actual output (no tests cover sparsity yet — see tests ).
  • Raised a small issue about toqito.rand.random_state_vector inconsistencies.

I didn’t go too deep into fixing these yet, but they’re now on the radar for improvement.

Tasks Completed

  • Benchmarked relevant functions from toqito/channels/.
  • Completed 38 benchmarks across 515 tests.
  • Identified issues in toqito.perms.unvec,toqito.perms.permutation_operator.
  • Raised issue for toqito.rand.random_state_vector (here) and, toqito.matrices.pauli (here)

<
Previous Post
Week 3 (16th June to 22nd June)
>
Next Post
Week 5 (30th June to 6th July)