Improve on functionality for matrices with zero dimensions

Generally the argument for leading dimension of a matrix in BLAS and LAPACK calls must be at least one even though you are allowed to supply matrices with zero dimensions. Many of the wrappers could therefore make illegal calls. This pull request solves that problem. In addition the handling of zero dimension matrices is handled in some function before calling BLAS/LAPACK either for efficiency reasons or because the code would give wrong answers as for example `null` and `pinv`.