For future reference: a slight surprise with PDL is the first dimension is column, second is row, unlike with Fortran, normal maths, etc. So sequence(2,3) has 2 columns, not 3. Printing out the ndarray shows what's going on. PDL::LinearAlgebra has many useful matrix functions that wrap lightning-fast LAPACK routines. I'd recommend that over the routines in PDL::MatrixOps, but see https://metacpan.org/pod/PDL::MatrixOps#lu_backsub for a comparison of the various available ways to solve linear problems with PDL.