QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.

Home Page:https://yaoquantum.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault in expect on heisenberg size mismatch

tabasavr opened this issue · comments

using Yao, YaoExtensions
circ = dispatch!(variational_circuit(4, 2), :random);
h = heisenberg(2);
expect(h, zero_state(4)=>circ)

This code causes segfault. Not very consistent, sometimes I need to do more work in repl before it crashes, sometimes just pasting it in fresh repl causes segfault. Also crashes only if operator size is bigger than state size.
Tried same code with kron as operator, it returns error about size mismatch.
Found by accident.

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

Full stacktrace

Thanks for your report. This issue would be fixed by this PR: QuantumBFS/YaoBlocks.jl#156