@@ -16,18 +16,20 @@ function AC2Spec(mps, mpo; site = length(mps) ÷ 2)
1616 return AC2Spec (physicalspaces, mps_virtualspaces, mpo_virtualspaces, ks)
1717end
1818
19+ benchname (spec:: AC2Spec ) = dim (spec. mps_virtualspaces[1 ]), dim (spec. mpo_virtualspaces[1 ])
20+
1921# Benchmarks
2022# ----------
2123function MPSKit. MPO_AC2_Hamiltonian (spec:: AC2Spec{S} ; T:: Type = Float64) where {S}
2224 GL = randn (T, spec. mps_virtualspaces[1 ] ⊗ spec. mpo_virtualspaces[1 ]' ← spec. mps_virtualspaces[1 ])
2325 GR = randn (T, spec. mps_virtualspaces[3 ] ⊗ spec. mpo_virtualspaces[3 ] ← spec. mps_virtualspaces[3 ])
24- W1 = JordanMPOTensor {T, S} (undef, spec. mpo_virtualspaces[1 ] ⊗ spec. physicalspaces[1 ] ← spec. physicalspaces[1 ] ⊗ spec. mpo_virtualspaces[2 ])
26+ W1 = MPSKit . JordanMPOTensor {T, S} (undef, spec. mpo_virtualspaces[1 ] ⊗ spec. physicalspaces[1 ] ← spec. physicalspaces[1 ] ⊗ spec. mpo_virtualspaces[2 ])
2527 for (r, c) in spec. nonzero_keys[1 ]
2628 r == c == 1 && continue
2729 r == size (W1, 1 ) && c == size (W1, 4 ) && continue
2830 W1[r, 1 , 1 , c] = randn! (W1[r, 1 , 1 , c])
2931 end
30- W2 = JordanMPOTensor {T, S} (undef, spec. mpo_virtualspaces[2 ] ⊗ spec. physicalspaces[2 ] ← spec. physicalspaces[2 ] ⊗ spec. mpo_virtualspaces[3 ])
32+ W2 = MPSKit . JordanMPOTensor {T, S} (undef, spec. mpo_virtualspaces[2 ] ⊗ spec. physicalspaces[2 ] ← spec. physicalspaces[2 ] ⊗ spec. mpo_virtualspaces[3 ])
3133 for (r, c) in spec. nonzero_keys[2 ]
3234 r == c == 1 && continue
3335 r == size (W2, 1 ) && c == size (W2, 4 ) && continue
@@ -68,10 +70,11 @@ function tomlify(spec::AC2Spec)
6870end
6971
7072function untomlify (:: Type{AC2Spec} , x)
71- physicalspaces = Tuple (map (untomlify, x[" physicalspaces" ]))
72- mps_virtualspaces = Tuple (map (untomlify, x[" mps_virtualspaces" ]))
73- mpo_virtualspaces = Tuple (map (untomlify, x[" mpo_virtualspaces" ]))
74- nonzero_keys = Tuple (map (Base. Fix1 (map, Base. Fix1 (map, Tuple)), x[" nonzero_keys" ]))
73+ to_space = Base. Fix1 (untomlify, VectorSpace)
74+ physicalspaces = Tuple (map (to_space, x[" physicalspaces" ]))
75+ mps_virtualspaces = Tuple (map (to_space, x[" mps_virtualspaces" ]))
76+ mpo_virtualspaces = Tuple (map (to_space, x[" mpo_virtualspaces" ]))
77+ nonzero_keys = Tuple (map (Base. Fix1 (map, Tuple), x[" nonzero_keys" ]))
7578 return AC2Spec (physicalspaces, mps_virtualspaces, mpo_virtualspaces, nonzero_keys)
7679end
7780
0 commit comments