fixed a bug in HSM implementation and started a less naive ARD implementation
implemented gradients for more clever HSM
extended test for degInf