code: private void makeSingularPositive() {
          numSingular = qralg.getNumberOfSingularValues();
          singularValues = qralg.getSingularValues();
  
          for( int i = 0; i < numSingular; i++ ) {
              double val = qralg.getSingularValue(i);
  
              if( val < 0 ) {
                  singularValues[i] = 0.0 - 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.set(j, 0.0 - Ut.get(j));
                      }
                  }
              } else {
                  singularValues[i] = val;
              }
          }
      }
docs: With the QR algorithm it is possible for the found singular values to be negative.  This
  makes them all positive by multiplying it by a diagonal matrix that has