turns out that the c++ code segfaults in 1d...