This code is adapted from the code of Gauge Flow Matching [1].

To run our simulation experiments, see "./scripts/polytope10.sh".
Example can be "l2ball6" or "polytope10".

We implemented our mirror map in "gauge_map.py":
    function "mirror_forward_polytope", "mirror_backward_polytope" are for polytope example.
    function "mirror_forward", "mirror_backward" are for L_2 ball example.

We modified "reflections.py" to implement reflection function for Reflected Flow Matching on L_2 ball. 
    The "ball_reflect" function implemented by [1] was renamed to "ball_reflect_old"
    The current "ball_reflect" function is for our experiment with r = 12.

We modified "examples.py" in folder "examples".
    We added method "mirror_flow_matching" and "mirror_flow_matching_T" for G-Flow and t-Flow respectively.
    Current implementation is for L_2 ball example. 
    To run polytope example, please change "self.training_samples = self.gauge_map.mirror_forward(self.true_samples)" to "self.training_samples = self.gauge_map.mirror_forward_polytope(self.true_samples)"

Remarks: 
    The sampling process are located in function "gen0", see "/examples/l2ball.py" and "/examples/polytope.py".

[1] Xinpeng Li, Enming Liang, and Minghua Chen. Gauge flow matching for efficient constrained
generative modeling over general convex set. In ICLR 2025 Workshop on Deep Generative Model
in Machine Learning: Theory, Principle and Efficacy, 2025.