public void sortByEigenValue ( Comparator < Double > cmp ) { if ( isComplex ( ) ) throw new ArithmeticException ( "Eigen values can not be sorted due to complex results" ) ; IndexTable it = new IndexTable ( DoubleList . unmodifiableView ( d , d . length ) , cmp ) ; for ( int i = 0 ; i < d . length ; i ++ ) { RowColumnOps . swapCol ( V , i , it . index ( i ) ) ; double tmp = d [ i ] ; d [ i ] = d [ it . index ( i ) ] ; d [ it . index ( i ) ] = tmp ; it . swap ( i , it . index ( i ) ) ; } }
Sorts the eigen values and the corresponding eigenvector columns by the associated eigen value . Sorting can not occur if complex values are present .