matflow.subset_simulation.subset_simulation.weakest_link_coarse_gradient_xt#
- matflow.subset_simulation.subset_simulation.weakest_link_coarse_gradient_xt(x_t, group_idx)#
Analytic gradient of weakest_link_performance_coarse (i.e. of max(block_average(x_t)) - y_star) with respect to x_t (the transformed/ physical-space input), for a single state vector x_t (1D, shape (dimension,)).
The block-average-then-max function is piecewise linear: within the block that currently achieves the max, d(max)/d(x_t_i) = 1/block_size for every fine index i in that block (since averaging distributes the derivative equally across the block), and 0 for indices in any other block. Ties (multiple blocks achieving the same max) are broken by taking the first such block – a measure-zero event for continuous inputs, so this doesn’t affect correctness in practice.