Added actual calculation of gradient(with htemp) and set freqs_ to null in constructor by default.