def _get_area_under_curve()

in privacy_lint/attack_results.py [0:0]


    def _get_area_under_curve(x: torch.Tensor, y: torch.Tensor) -> float:
        """
        Computes the area under the parametric curve defined by (x, y).

        Notes:
            - x is assumed to be sorted in ascending order
            - y is not assumed to be monotonous
        """

        dx = x[1:] - x[:-1]
        dy = (y[1:] - y[:-1]).abs()
        result = (dx * y[:-1]).sum() + (dy * dx).sum()
        return result.item()