You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across an example of a dsl file where slicing 4 bonds works fine but slicing 5 bonds gives the following error:
ERROR: LoadError: BoundsError: attempt to access 2-element Vector{ComplexF32} at index [3:3]
Stacktrace:
[1] throw_boundserror(A::Vector{ComplexF32}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:691
[2] checkbounds
@ ./abstractarray.jl:656 [inlined]
[3] view(A::Vector{ComplexF32}, I::UnitRange{Int64})
@ Base ./subarray.jl:177
[4] macro expansion
@ ~/Code/QXContexts/QXContexts.jl/src/contexts/base.jl:115 [inlined]
I've checked with both QXContexts versions on master and simulation-refactor branches and the issue exists in both. It's not clear to me what's causing the issue yet. I've added the example dsl files here. Running the following should reproduce the error:
using QXContexts
dsl_file = "./examples/sycamore/sycamore_53_4_0.qx"
data_file = "./examples/sycamore/sycamore_53_4_0.jld2"
cg, _ = parse_dsl_files(dsl_file, data_file)
ctx = QXContext{Array{ComplexF32}}(cg)
bitstring = [true for _ in 1:53]
slice_params = params(cg, ViewCommand)
num_slices = 5
dims = map(x -> slice_params[Symbol("v$(x)")]::Int, 1:num_slices)
slices = CartesianIndices(Tuple(dims))
slice = slices[65] # using slice[64] works
ctx(bitstring, slice)
The text was updated successfully, but these errors were encountered:
Issue here is that it's trying to slice a bond of dimension 2 with bond value 3. When calling set_slice_vals! the order of the values is not v1, v2, v3 etc... (as it does not care what format the symbols take). It is the order in which these appear in the slice_dims OrderedDict data member of QXContexts (whose order depends on the order of traversal when constructing the QXContexts struct from the compute graph).
The above example will run if updated to
using QXContexts
dsl_file = "./examples/sycamore/sycamore_53_4_0.qx"
data_file = "./examples/sycamore/sycamore_53_4_0.jld2"
cg, _ = parse_dsl_files(dsl_file, data_file)
ctx = QXContext{Array{ComplexF32}}(cg)
bitstring = [true for _ in 1:53]
slice_params = params(cg, ViewCommand)
num_slices = 5
dims = collect(values(ctx.slice_dims))[1:num_slices]
slices = CartesianIndices(Tuple(dims))
slice = slices[65] # using slice[64] works
ctx(bitstring, slice)
I came across an example of a dsl file where slicing 4 bonds works fine but slicing 5 bonds gives the following error:
I've checked with both QXContexts versions on master and simulation-refactor branches and the issue exists in both. It's not clear to me what's causing the issue yet. I've added the example dsl files here. Running the following should reproduce the error:
The text was updated successfully, but these errors were encountered: