added NaN test for inverse_spd