ENH: Fix SyntaxError when matrix() is called with invalid string

The numpy.matrix constructor uses eval(str.translate(table)) to convert
input strings to numeric matrix contents. str.translate(table) will
return empty string if str consists only of invalid characters, causing
SyntaxError in eval(). This is confusing, as one would expect an
exception like TypeError when trying to construct a matrix from invalid
input.

This fix makes sure eval() is only called if str is not empty and
TypeError is raised otherwise.