de.lmu.ifi.dbs.elki.utilities.scaling
Class LinearScaling

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.scaling.LinearScaling
All Implemented Interfaces:
InspectionUtilFrequentlyScanned, Parameterizable, ScalingFunction, StaticScalingFunction

public class LinearScaling
extends Object
implements StaticScalingFunction

Simple linear scaling function.


Field Summary
private  double factor
          Scaling factor
private  double shift
          Shift
 
Constructor Summary
LinearScaling()
          Constructor with defaults resulting in identity.
LinearScaling(double factor)
          Constructor with scaling only.
LinearScaling(double factor, double shift)
          Full constructor.
LinearScaling(DoubleMinMax minmax)
          Constructor from a double minmax.
 
Method Summary
static LinearScaling fromMinMax(double min, double max)
          Make a linear scaling from a given minimum and maximum.
 double getMax()
          Get maximum resulting value.
 double getMin()
          Get minimum resulting value.
 double getScaled(double d)
          Transform a given value using the scaling function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factor

private double factor
Scaling factor


shift

private double shift
Shift

Constructor Detail

LinearScaling

public LinearScaling()
Constructor with defaults resulting in identity.


LinearScaling

public LinearScaling(double factor)
Constructor with scaling only.

Parameters:
factor - Scaling factor

LinearScaling

public LinearScaling(double factor,
                     double shift)
Full constructor.

Parameters:
factor - Scaling factor
shift - Shift value

LinearScaling

public LinearScaling(DoubleMinMax minmax)
Constructor from a double minmax.

Parameters:
minmax - Minimum and Maximum
Method Detail

getScaled

public double getScaled(double d)
Description copied from interface: ScalingFunction
Transform a given value using the scaling function.

Specified by:
getScaled in interface ScalingFunction
Parameters:
d - Original value
Returns:
Scaled value

getMin

public double getMin()
Description copied from interface: ScalingFunction
Get minimum resulting value. May be Double.NaN or Double.NEGATIVE_INFINITY.

Specified by:
getMin in interface ScalingFunction
Returns:
Minimum resulting value.

getMax

public double getMax()
Description copied from interface: ScalingFunction
Get maximum resulting value. May be Double.NaN or Double.POSITIVE_INFINITY.

Specified by:
getMax in interface ScalingFunction
Returns:
Maximum resulting value.

fromMinMax

public static LinearScaling fromMinMax(double min,
                                       double max)
Make a linear scaling from a given minimum and maximum. The minimum will be mapped to zero, the maximum to one.

Parameters:
min - Minimum
max - Maximum
Returns:
New linear scaling.

Release 0.4.0 (2011-09-20_1324)