Skip to content

Commit e699ff7

Browse files
committed
fix docs index and ruff format many files
1 parent 722b0c8 commit e699ff7

39 files changed

+939
-639
lines changed

docs/index_matrix.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
:numbered:
55
:maxdepth: 2
66
7-
matrix-basics
8-
matrix-generate
9-
matrix-calculating quantities
10-
matrix-solving systems
11-
matrix-distributed parallelism - mpi
12-
matrix-dynamics and evolution
7+
matrix/matrix-basics
8+
matrix/matrix-generate
9+
matrix/matrix-calculating quantities
10+
matrix/matrix-solving systems
11+
matrix/matrix-distributed parallelism - mpi
12+
matrix/matrix-dynamics and evolution
1313
```

docs/index_operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
:numbered:
55
:maxdepth: 2
66
7-
operator-basics
7+
operator/operator-basics
88
```

docs/index_tn.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
:numbered:
55
:maxdepth: 2
66
7-
tensor-basics
8-
tensor-contraction
9-
tensor-drawing
10-
tensor-optimization
11-
tensor-1d
12-
tensor-2d
13-
tensor-circuit
14-
tensor-circuit-mps
15-
tensor-design
7+
tensor/tensor-basics
8+
tensor/tensor-contraction
9+
tensor/tensor-drawing
10+
tensor/tensor-optimization
11+
tensor/tensor-1d
12+
tensor/tensor-2d
13+
tensor/tensor-circuit
14+
tensor/tensor-circuit-mps
15+
tensor/tensor-design
1616
```

quimb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Quantum Information for Many-Body calculations.
33
"""
4+
45
try:
56
# -- Distribution mode --
67
# import from _version.py generated by setuptools_scm during release

quimb/experimental/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Submodule for experimental features that are likely untested and subject to
22
change.
3-
"""
3+
"""

quimb/experimental/autojittn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
TODO:
44
- [ ] check and cache on input shapes
55
"""
6+
67
import functools
78

89
import autoray as ar
@@ -32,7 +33,6 @@ def _setup(self, *args, **kwargs):
3233

3334
@self.decorator(**self.decorator_opts)
3435
def pyfn(*pytrees):
35-
3636
# inject back into the skeletons
3737
flat = [unpack(p, skel) for p, skel in zip(pytrees, skeletons)]
3838
args, kwargs = ar.tree_unflatten(flat, ref_tree)

quimb/experimental/cluster_update/cluster update gen example.ipynb

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@
5353
" if method == \"cluster\":\n",
5454
" gauges = gauges.copy()\n",
5555
" psi.gauge_all_simple_(100, 1e-6, gauges=gauges)\n",
56-
" return psi.compute_local_expectation_cluster(\n",
57-
" ham.terms,\n",
58-
" max_distance=0,\n",
59-
" normalized=True,\n",
60-
" gauges=gauges,\n",
61-
" optimize=\"auto-hq\",\n",
62-
" ) / psi.nsites\n",
56+
" return (\n",
57+
" psi.compute_local_expectation_cluster(\n",
58+
" ham.terms,\n",
59+
" max_distance=0,\n",
60+
" normalized=True,\n",
61+
" gauges=gauges,\n",
62+
" optimize=\"auto-hq\",\n",
63+
" )\n",
64+
" / psi.nsites\n",
65+
" )\n",
6366
"\n",
6467
" psi = psi.copy()\n",
6568
" if gauges is not None:\n",
@@ -70,17 +73,21 @@
7073
" return psi.compute_local_expectation_exact(ham.terms) / psi.nsites\n",
7174
"\n",
7275
" if method == \"boundary\":\n",
73-
"\n",
7476
" if max_bond is None:\n",
75-
" max_bond = max(16, psi.max_bond()**2)\n",
77+
" max_bond = max(16, psi.max_bond() ** 2)\n",
7678
"\n",
77-
" return psi.compute_local_expectation(\n",
78-
" ham.terms,\n",
79-
" max_bond=max(16, psi.max_bond()**2),\n",
80-
" equalize_norms=1.0,\n",
81-
" normalized=True,\n",
82-
" layer_tags=None, mode=\"fit-zipup\", bsz=1,\n",
83-
" ) / psi.nsites"
79+
" return (\n",
80+
" psi.compute_local_expectation(\n",
81+
" ham.terms,\n",
82+
" max_bond=max(16, psi.max_bond() ** 2),\n",
83+
" equalize_norms=1.0,\n",
84+
" normalized=True,\n",
85+
" layer_tags=None,\n",
86+
" mode=\"fit-zipup\",\n",
87+
" bsz=1,\n",
88+
" )\n",
89+
" / psi.nsites\n",
90+
" )"
8491
]
8592
},
8693
{
@@ -99,7 +106,7 @@
99106
"outputs": [],
100107
"source": [
101108
"D = 4\n",
102-
"psi = qtn.PEPS.rand(L, L, D, seed=42, dist=\"uniform\", loc=-1/3)"
109+
"psi = qtn.PEPS.rand(L, L, D, seed=42, dist=\"uniform\", loc=-1 / 3)"
103110
]
104111
},
105112
{
@@ -184,8 +191,10 @@
184191
"source": [
185192
"def to_backend(x):\n",
186193
" import torch\n",
194+
"\n",
187195
" return torch.tensor(x, dtype=torch.float32, device=\"cuda\")\n",
188196
"\n",
197+
"\n",
189198
"psi.apply_to_arrays(to_backend)\n",
190199
"ham.apply_to_arrays(to_backend)"
191200
]

quimb/experimental/cluster_update/cluster_update_old.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Implementation of arbitrary geometry wavefunction cluster update.
2-
"""
1+
"""Implementation of arbitrary geometry wavefunction cluster update."""
2+
33
import functools
44

55
from quimb.tensor.tensor_core import ensure_dict, bonds, bonds_size, do

quimb/experimental/cluster_update/cxu.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,9 @@ def compress_between_tids_bondenv_gloop_expand(
613613
# and and possibly gauge region
614614
k = self._select_tids(r, virtual=False)
615615
if gauges is not None:
616-
k.gauge_simple_insert(gauges, power=gauge_power, smudge=gauge_smudge)
616+
k.gauge_simple_insert(
617+
gauges, power=gauge_power, smudge=gauge_smudge
618+
)
617619

618620
# contract the 4-index bond tensor given by this region
619621
k._cut_between_tids(tida, tidb, "kl", "kr")
@@ -863,4 +865,4 @@ def assemble_plot_data(self):
863865
"y": self.max_fit_distances,
864866
"yscale": "log",
865867
}
866-
return data
868+
return data

0 commit comments

Comments
 (0)