added NaN test for subtract
added NaN test for diag_matrix
added NaN test for inverse