Commit ae7018a
Move random_tensornetwork, random_ttn, random_mps, ModelHamiltonians to test/utils.jl
Pull non-basic constructors that are only used by tests out of `src/` and
into a new `test/utils.jl` helper file. Each test that needs them does
`include("utils.jl")` inside its gensym module. The file is intentionally
named `utils.jl` so the `ITensorPkgSkeleton.runtests` runner does not
auto-pick it up (the runner only globs `test_*.jl`).
What moved:
- `random_tensornetwork` (12 method specializations, including the
`Distribution`- and `IsUnderlyingGraph`-based variants) — moved from
`src/specialitensornetworks.jl` to `test/utils.jl`.
- `random_ttn` and `random_mps` — moved from
`src/treetensornetworks/treetensornetwork.jl` to `test/utils.jl`.
These thin wrappers around `random_tensornetwork` had no real consumers
in `src/` (only docstring examples) and a single test reference.
- `ModelHamiltonians.tight_binding`, `heisenberg`, `ising`, plus the
internal helpers `to_callable`, `nth_nearest_neighbors`,
`next_nearest_neighbors` — moved from `src/lib/ModelHamiltonians/` to
a `ModelHamiltonians` submodule in `test/utils.jl`. Test sites continue
to call them as `ModelHamiltonians.ising(...)` etc.
What was deleted outright:
- `delta_network` (and the entire `src/specialitensornetworks.jl`) — the
only consumer was `ModelNetworks.ising_network`, which itself had no
consumers.
- `ModelHamiltonians.hubbard` — no consumers.
- `src/lib/ModelNetworks/` (`ising_network`, `ising_network_state`) — no
consumers; the lone `using ITensorNetworks.ModelNetworks: ModelNetworks`
in `test/test_belief_propagation.jl` was an unused import.
- `random_ttn` / `random_mps` jldoctest examples in `src/normalize.jl`,
`src/expect.jl`, `src/treetensornetworks/abstracttreetensornetwork.jl`
(per the rule that doc examples should not depend on functions being
removed). The `[`random_ttn`](@ref)` / `[`random_mps`](@ref)` references
in `See also:` lists were dropped as well.
`docs/src/computing_properties.md`, `tree_tensor_networks.md`, and
`solvers.md` were updated to drop their `random_ttn` / `random_mps` calls;
the `@autodocs` listing in `docs/src/reference.md` was trimmed to just
`ITensorNetworks` (no longer pulling in the removed `ModelNetworks` /
`ModelHamiltonians` submodules).
A few imports that were previously available inside `ITensorNetworks` as
a side effect of the deleted files' `using` clauses are now imported
directly by the files that actually use them:
- `ITensors: delta` — `src/formnetworks/bilinearformnetwork.jl`,
`src/caches/abstractbeliefpropagationcache.jl`
Bump to 0.19.0 (breaking, pre-1.0 minor bump) and update pinned
`ITensorNetworks` compat in `test/`, `docs/`, and `examples/` Project.toml.
Also add `SimpleTraits` to `test/Project.toml` so `test/utils.jl` can use
the `@traitfn` macro.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 31bb354 commit ae7018a
33 files changed
Lines changed: 256 additions & 495 deletions
File tree
- docs
- src
- examples
- src
- caches
- formnetworks
- lib
- ModelHamiltonians/src
- ModelNetworks/src
- treetensornetworks
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | | - | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | | - | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
48 | | - | |
49 | | - | |
50 | 44 | | |
51 | 45 | | |
52 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
67 | | - | |
68 | 65 | | |
69 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 100 | | |
118 | 101 | | |
119 | 102 | | |
| |||
0 commit comments