Jacobian of function returning $m$ evenly-spaced order statistics of an $n$-dimensional vector Let $y\in\mathbb{R}^n$, and let $f:\mathbb{R}^n\to\mathbb{R}^m$ be the transformation that outputs $m$ evenly-spaced order statistics (including the extremes) of $y$.

What is the Jacobian of this transformation?

My Attempt
I tried coding this in Python and using automatic differentiation, but unfortunately doesn't seem to work. Hence, I would like to obtain an analytical formula for the Jacobian of this transformation. Essentially the mapping does this:

*

*Sorts $y$ in increasing order

*Grabs $min(y)$, $(m-2)$-evenly spaced quantiles, $max(y)$ from the sorted vector


Taking the min, max, and some quantile is not a differentiable operation by default.
There is literature on implementing those operations in a differentiable way, then you can apply automatic differentiation. Have a look at "Differentiable Ranking and Sorting using Optimal Transport" https://proceedings.neurips.cc/paper/2019/hash/d8c24ca8f23c562a5600876ca2a550ce-Abstract.html
