added NaN test for diag_post_multiply