Feature/issue 891 check matching dims nan

#### Summary:
Added NaN test and doc in code for check_matching_dims.

#### Intended Effect:
Added NaN test and doc in code for check_matching_dims.

#### How to Verify:
Run test/unit/math/error_handling/matrix/check_matching_dims

#### Side Effects:
None.

#### Documentation:
Added doc in the code.

#### Reviewer Suggestions:
Anyone.