Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying init to the reducer #559

Open
jon-wurtz opened this issue May 15, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@jon-wurtz
Copy link
Collaborator

SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}(1, ComplexF64[1.0 + 0.0im, 0.0 + 0.0im], Subspace{Int64,
Vector{Int64}}(1, Dict(0 => 1, 1 => 2), [0, 1]))ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying init to the reducer
Stacktrace:
[1] reduce_empty(op::Base.MappingRF{BloqadeExpr.var"#27#28"{ComplexF64, Subspace{Int64, Vector{Int64}}}, typeof(+)}, #unused#::Type{AbstractBlock{2}})
@ Base .\reduce.jl:356
[2] reduce_empty_iter
@ .\reduce.jl:379 [inlined]
[3] mapreduce_empty_iter(f::Function, op::Function, itr::Vector{AbstractBlock{2}}, ItrEltype::Base.HasEltype)
@ Base .\reduce.jl:375
[4] _mapreduce(f::BloqadeExpr.var"#27#28"{ComplexF64, Subspace{Int64, Vector{Int64}}}, op::typeof(+), #unused#::IndexLinear, A::Vector{AbstractBlock{2}})
@ Base .\reduce.jl:427
[5] _mapreduce_dim
@ .\reducedim.jl:365 [inlined]
[6] #mapreduce#765
@ .\reducedim.jl:357 [inlined]
[7] mapreduce
@ .\reducedim.jl:357 [inlined]
[8] mat(#unused#::Type{ComplexF64}, x::Add{2}, s::Subspace{Int64, Vector{Int64}})
@ BloqadeExpr C:\Users\jwurtz.julia\packages\BloqadeExpr\7XHOo\src\mat.jl:59
[9] mat(#unused#::Type{ComplexF64}, h::RydInteract{2}, space::Subspace{Int64, Vector{Int64}})
@ BloqadeExpr C:\Users\jwurtz.julia\packages\BloqadeExpr\7XHOo\src\mat.jl:41
[10] mat(#unused#::Type{ComplexF64}, x::Scale{Int64, 2, RydInteract{2}}, s::Subspace{Int64, Vector{Int64}})
@ BloqadeExpr C:\Users\jwurtz.julia\packages\BloqadeExpr\7XHOo\src\mat.jl:55
[11] BloqadeExpr.Hamiltonian(::Type{ComplexF64}, ex::RydbergHamiltonian, space::Subspace{Int64, Vector{Int64}})
@ BloqadeExpr C:\Users\jwurtz.julia\packages\BloqadeExpr\7XHOo\src\lower.jl:169
[12] SchrodingerProblem(reg::SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}, tspan::Int64, expr::RydbergHamiltonian; algo::CompositeAlgorithm{Tuple{Vern9{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{0, false, Nothing, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, AutoSwitch{Vern9{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{0, false, Nothing, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ BloqadeODE C:\Users\jwurtz.julia\packages\BloqadeODE\JjdjV\src\problem.jl:89
[13] SchrodingerProblem(reg::SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}, tspan::Int64, expr::RydbergHamiltonian)
@ BloqadeODE C:\Users\jwurtz.julia\packages\BloqadeODE\JjdjV\src\problem.jl:79
[14] emulate_from_file(filename::String)
@ Main c:\Users\jwurtz\Documents\GITHUB\BP_EVchargers\BP_chargers\quantum\bloqadepy.jl:43
[15] top-level scope
@ REPL[24]:1

@jon-wurtz jon-wurtz added the bug Something isn't working label May 15, 2023
@jon-wurtz
Copy link
Collaborator Author

Runs in the full space but not in the subspace

#space = blockade_subspace(positions, blockade_radius)
        hamiltonian = rydberg_h(positions; Ω = omega, Δ = delta, ϕ = phi)
        #print(hamiltonian)
        #print(zero_state(space))

        prob = SchrodingerProblem(zero_state(nqubits(hamiltonian)), final_time, hamiltonian)
        emulate!(prob)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant