added NaN test for diagonal
added NaN test for diag_matrix