Fix bug in log_determinant_spd and add a unit test.