added NaN test for diag_pre_multiply