hard_threshold() implements the hard-thresholding operator on a given
matrix D, making D sparser: elements of D whose absolute value are less
than a given threshold thresh are set to 0, i.e. \(D[|D| < thresh] = 0\).
This is used in the non-convex PCP function rrmc() to provide a non-convex
replacement for the prox_l1() method used in the convex PCP function
root_pcp(). It is used to iteratively model the sparse S matrix with the
help of an adaptive threshold (thresh changes over the course of
optimization).