could be inplace or as a new array
I think we should not throw an error
function scale(array, min, max) {
var minMax=ML.Stat.array.minMax(array);
if (minMax.max===minMax.min) throw new Error('normalize: max must be different from in');
var slope=(max-min)/(minMax.max-minMax.min);
console.log(slope);
for (var i=0; i<array.length; i++) {
array[i]=(array[i]-minMax.min)*slope+min;
}
console.log(array);
return array;
}
could be inplace or as a new array
I think we should not throw an error