# Rf/svd error

Issue #1 (closed) highlighted the fact that, while the `armawrap`

implementation of `NEWMAT::SVD`

does crash when given a matrix with less rows than columms (which preserves compatibility with the behaviour of the original `NEWMAT::SVD`

function), it crashes in a different, unintentional manner.

This patch adds an explicit check, to make the crash and error message more interpretable.

It also turns out that the `arma::svd`

and `arma::svd_econ`

functions behave slightly differently, in that `arma::svd`

returns `U`

as a square matrix of shape `(X.n_rows, X.n_rows)`

, whereas `arma::svd_econ`

truncates `U`

to have the same shape as the input matrix `X`

(which is the desired behaviour, as this is what the original `NEWMAT::SVD`

function did).

So this MR also removes the explicit truncation of the matrix `U`

, which was only necessary when `arma::svd`

was being used.