added NaN test for check_matching_dims
added doc in code for check_matching_dims