public void computeHessianScaling(DMatrixRMaj scaling ) {

		double max = 0;
		for (int i = 0; i < scaling.numRows; i++) {
			// mathematically it should never be negative but...
			double v = scaling.data[i] = sqrt(abs(scaling.data[i]));
			if( v > max )
				max = v;
		}

		// Add this number to avoid divide by zero.
		// Ceres solver just uses 1 no matter what. That's probably not the best approach because if you're doing
		// with very small numbers scaling will be washed out
		max *= 1e-12;
		for (int i = 0; i < scaling.numRows; i++) {
			scaling.data[i] += max;
		}
	}
public void computeHessianScaling ( DMatrixRMaj scaling ) { double max = 0 ; for ( int i = 0 ; i < scaling . numRows ; i ++ ) { double v = scaling . data [ i ] = sqrt ( abs ( scaling . data [ i ] ) ) ; if ( v > max ) max = v ; } max *= 1e-12 ; for ( int i = 0 ; i < scaling . numRows ; i ++ ) { scaling . data [ i ] += max ; } }
Applies the standard formula for computing scaling. This is broken off into its own
function so that it easily invoked if the function above is overridden

@param scaling Vector containing scaling information