Some updates for linear algebra utilities

minor: you can interchange these two lines and get rid of `+ 1` if you like, but if you believe it's more readable this way, that's perfectly okay.