I noticed that the following call to affine_transform_mpo results in a segmentation fault:
using ITensors
using Quantics
function main()
A = [ 1 1;
-1 1 ]
b = [-32, 32]
R = 6
D = 2
y_sites = [ Index(2, "d=$(d),r=$(r)") for d in 1:D for r in 1:R ]
x_sites = prime.(y_sites)
# using "new" indices doesn't help
# x_sites = [ Index(2, "d=$(d),r=$(r)")' for d in 1:D for r in 1:R ]
y_sites_mat = reshape(y_sites, R, D)
x_sites_mat = reshape(x_sites, R, D)
display(y_sites_mat)
display(x_sites_mat)
# CRASHES (segfault)
trafo_mpo = Quantics.affine_transform_mpo(
y_sites_mat,
x_sites_mat,
A,
b,
Quantics.OpenBoundaryConditions()
)
end
main()
This is due to the use of @inbounds in affine_transform_core. Removing these gives the expected
**ERROR**: BoundsError: attempt to access 5×1×1 Array{Bool, 3} at index [1, 2, 1]
because bitrange has length 1 in this case.
Tentatively changing the line
bitrange = activebit ? range(0, 1) : range(0, 0)
to
removes the bounds error, but causes the above script to be killed due to excess memory usage (~50 GB) on my Macbook Pro M1.
Julia version: 1.11.7
Branch/commit: main / 7c15521
I noticed that the following call to
affine_transform_mporesults in a segmentation fault:This is due to the use of
@inboundsinaffine_transform_core. Removing these gives the expectedbecause
bitrangehas length 1 in this case.Tentatively changing the line
to
removes the bounds error, but causes the above script to be killed due to excess memory usage (~50 GB) on my Macbook Pro M1.
Julia version: 1.11.7
Branch/commit: main / 7c15521