private void makeSingularPositive ( ) { numSingular = qralg . getNumberOfSingularValues ( ) ; singularValues = qralg . getSingularValues ( ) ; for ( int i = 0 ; i < numSingular ; i ++ ) { double val = singularValues [ i ] ; if ( val < 0 ) { singularValues [ i ] = - val ; if ( computeU ) { // compute the results of multiplying it by an element of -1 at this location in // a diagonal matrix. int start = i * Ut . numCols ; int stop = start + Ut . numCols ; for ( int j = start ; j < stop ; j ++ ) { Ut . data [ j ] = - Ut . data [ j ] ; } } } } }
With the QR algorithm it is possible for the found singular values to be native . This makes them all positive by multiplying it by a diagonal matrix that has