77function rescale (
88 alg:: Algorithm"exact" ,
99 tn:: AbstractITensorNetwork ;
10- vs_to_rescale = collect (vertices (tn)),
10+ verts_to_rescale = collect (vertices (tn)),
1111 kwargs... ,
1212)
1313 logn = logscalar (alg, tn; kwargs... )
14- c = inv (exp (logn / length (vs_to_rescale )))
14+ c = inv (exp (logn / length (verts_to_rescale )))
1515 tn = copy (tn)
16- for v in vs_to_rescale
16+ for v in verts_to_rescale
1717 tn[v] *= c
1818 end
1919 return tn
2222function rescale (
2323 alg:: Algorithm ,
2424 tn:: AbstractITensorNetwork ;
25- vs_to_rescale= collect (vertices (tn)),
2625 (cache!)= nothing ,
2726 cache_construction_kwargs= default_cache_construction_kwargs (alg, tn),
2827 update_cache= isnothing (cache!),
2928 cache_update_kwargs= default_cache_update_kwargs (alg),
29+ kwargs... ,
3030)
3131 if isnothing (cache!)
3232 cache! = Ref (cache (alg, tn; cache_construction_kwargs... ))
@@ -36,7 +36,7 @@ function rescale(
3636 cache![] = update (cache![]; cache_update_kwargs... )
3737 end
3838
39- cache![] = rescale (cache![]; vs_to_rescale )
39+ cache![] = rescale (cache![]; kwargs ... )
4040
4141 return tensornetwork (cache![])
4242end
@@ -68,10 +68,12 @@ function LinearAlgebra.normalize(
6868 end
6969
7070 vs = collect (vertices (tn))
71- vs_to_rescale = vcat (
71+ verts_to_rescale = vcat (
7272 [ket_vertex (norm_tn, v) for v in vs], [bra_vertex (norm_tn, v) for v in vs]
7373 )
74- norm_tn = rescale (alg, norm_tn; vs_to_rescale, cache!, update_cache, cache_update_kwargs)
74+ norm_tn = rescale (
75+ alg, norm_tn; verts_to_rescale, cache!, update_cache, cache_update_kwargs
76+ )
7577
7678 return ket_network (norm_tn)
7779end
0 commit comments