loopy bp implementation