code basically done, small error in the result. not sure what
Merge origin/master
some error in HNF function.
also check diag_to_smith