Check for NaN

hcp.py will throw an assertion error if input matrices contain Nan.
Test was added to check that NaNs are detected.