@ Override public boolean decompose ( DMatrixRMaj orig ) { if ( orig . numCols != orig . numRows ) throw new IllegalArgumentException ( "Matrix must be square." ) ; if ( orig . numCols <= 0 ) return false ; int N = orig . numRows ; // compute a similar tridiagonal matrix if ( ! decomp . decompose ( orig ) ) return false ; if ( diag == null || diag . length < N ) { diag = new double [ N ] ; off = new double [ N - 1 ] ; } decomp . getDiagonal ( diag , off ) ; // Tell the helper to work with this matrix helper . init ( diag , off , N ) ; if ( computeVectors ) { if ( computeVectorsWithValues ) { return extractTogether ( ) ; } else { return extractSeparate ( N ) ; } } else { return computeEigenValues ( ) ; } }
Decomposes the matrix using the QR algorithm . Care was taken to minimize unnecessary memory copying and cache skipping .