function scale(input, options){
        var y;
        if(options.inPlace){
            y = input;
        }
        else{
            y = new Array(input.length);
        }
        const max = options.max;
        const min = options.min;
        if(typeof max === "number"){
            if(typeof min === "number"){
                var minMax = Stat.minMax(input);
                var factor = (max - min)/(minMax.max-minMax.min);
                for(var i=0;i< y.length;i++){
                    y[i]=(input[i]-minMax.min)*factor+min;
                }
            }
            else{
                var currentMin = Stat.max(input);
                var factor = max/currentMin;
                for(var i=0;i< y.length;i++){
                    y[i] = input[i]*factor;
                }
            }
        }
        else{
            if(typeof min === "number"){
                var currentMin = Stat.min(input);
                var factor = min/currentMin;
                for(var i=0;i< y.length;i++){
                    y[i] = input[i]*factor;
                }
            }
        }
        return y;
    }
To scale the input array between the specified min and max values. The operation is performed inplace
if the options.inplace is specified. If only one of the min or max parameters is specified, then the scaling
will multiply the input array by min/min(input) or max/max(input)
@param input
@param options
@returns {*}