docs: def average_loss(lc):
      """
      Given a loss curve array with `poe` and `loss` fields,
      computes the average loss on a period of time.
  
      :note: As the loss curve is supposed to be piecewise linear as it
             is a result of a linear interpolation, we compute an exact
             integral by using the trapeizodal rule with the width given by the
             loss bin width.
      """
      losses, poes = (lc['loss'], lc['poe']) if lc.dtype.names else lc
      return -pairwise_diff(losses) @ pairwise_mean(poes)