Գրեք սա: Fast memory-efficient generalized belief propagation