Fixes #2676 : Convert Matrix to NumPy Array with NumPy dtype

This is just #2678, but I merged with master and resolved conflicts.