From b6259ba6b3fabd422441ec10fbe1d6f6c159a2a9 Mon Sep 17 00:00:00 2001 From: Johnnie Gray Date: Fri, 31 Jan 2025 13:13:59 -0800 Subject: [PATCH] ruff format example [skip ci] --- docs/examples/ex_mpi_expm_evo.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/examples/ex_mpi_expm_evo.py b/docs/examples/ex_mpi_expm_evo.py index e70fa48c..fac10988 100644 --- a/docs/examples/ex_mpi_expm_evo.py +++ b/docs/examples/ex_mpi_expm_evo.py @@ -9,6 +9,7 @@ And will display slightly different output for each that explains the three modes. """ + import quimb as qu from mpi4py import MPI @@ -24,8 +25,9 @@ # this makes the function print some information when called # - in order to be pickled is has to be located in the main package -ham_heis_verbose = qu.utils.Verbosify(qu.ham_heis, - highlight='ownership', mpi=True) +ham_heis_verbose = qu.utils.Verbosify( + qu.ham_heis, highlight="ownership", mpi=True +) H = qu.Lazy(ham_heis_verbose, n=n, sparse=True, shape=shape) @@ -36,7 +38,7 @@ # evolve the system, processes split 'hard' work (slepc computations) # - should see each worker gets given a different ownership rows # - but all end up with the results. -evo = qu.Evolution(psi0, H, method='expm', expm_backend='slepc') +evo = qu.Evolution(psi0, H, method="expm", expm_backend="slepc") evo.update_to(5) @@ -47,14 +49,22 @@ dims = [2] * n bsz = 5 -logneg_subsys_verbose = qu.utils.Verbosify(qu.logneg_subsys, - highlight='sysb', mpi=True) +logneg_subsys_verbose = qu.utils.Verbosify( + qu.logneg_subsys, highlight="sysb", mpi=True +) # each process only computes its own fraction of these # - should see each process calls logneg with different ``sysb``. -fs = [pool.submit(logneg_subsys_verbose, evo.pt, dims=dims, - sysa=range(0, bsz), sysb=range(i, i + bsz)) - for i in range(bsz, n - bsz)] +fs = [ + pool.submit( + logneg_subsys_verbose, + evo.pt, + dims=dims, + sysa=range(0, bsz), + sysb=range(i, i + bsz), + ) + for i in range(bsz, n - bsz) +] # but then the results are comminucated to everyone rs = [f.result() for f in fs]