untested changes to use opegm's vectorized api, and reserve space
untested changes (completely untested..did not even run the file)
untested changes (completely untested..did not even run the file)
try to make @DerThorsten's code work.