public static MutableDoubleTuple normalizeElements ( DoubleTuple t , DoubleTuple min , DoubleTuple max , MutableDoubleTuple result ) { result = validate ( t , result ) ; for ( int i = 0 ; i < result . getSize ( ) ; i ++ ) { double value = t . get ( i ) ; double minValue = min . get ( i ) ; double maxValue = max . get ( i ) ; double alpha = ( value - minValue ) / ( maxValue - minValue ) ; double newValue = alpha ; result . set ( i , newValue ) ; } return result ; }
Normalize the elements of the given tuple so that each element will be linearly rescaled to the interval defined by the corresponding elements of the given minimum and maximum tuple . Each element that is equal to the corresponding minimum element will be 0 . 0 in the resulting tuple . Each element that is equal to the corresponding maximum element will be 1 . 0 in the resulting tuple . Other values will be interpolated accordingly .