public static void real ( TupleDesc_F64 input , TupleDesc_S8 output ) { double max = 0 ; for ( int i = 0 ; i < input . size ( ) ; i ++ ) { double v = Math . abs ( input . value [ i ] ) ; if ( v > max ) max = v ; } for ( int i = 0 ; i < input . size ( ) ; i ++ ) { output . value [ i ] = ( byte ) ( 127.0 * input . value [ i ] / max ) ; } }
Converts a floating point description with real values into the 8 - bit integer descriptor by dividing each element in the input by the element maximum absolute value and multiplying by 127 .