Imp
[using it]
Interface Manipulation Package v4.0 (2008-06-25) a-projector ©copyright Author


imp.estimator
Class Measure

java.lang.Object
  extended by imp.core.Value
      extended by imp.estimator.Measure
All Implemented Interfaces:
Cloneable, Comparable<Value>

public class Measure
extends Value

Defines a physical measure.

A measure represents a bounded value with a finite precision and a default value.
At the syntax level such a number is represented by the construct: $number = $name:$value|$default@$min..$max#$step$unit
Integer and centered/rescaled representation
A bounded parameter with a limited precision has thus a finite range of significant values which size is S = (max - min) / step.
Furthermore, using the transformation x -> z = x / step - c with c = (max + min) / (2 step) the parameter is now centered and rescaled with respect to the precision: so that |z| < S/2 while the step for z is 1.
About physical value specification It has been observed that there is a real gain to always take this experimental specification into account. Numerical algorithms can check consistency with respect to the bounds, automatically adjust their thresholds, increasing numerical stability and avoiding convergence to a non-negligible precision. Estimation methods can use step by step variations from an initial estimate towards the problem solution to guaranty stable local estimation.
About the number precision Such a precision is in practice very easy to estimate (e.g. 1 mm for a pupil ruler, 1 deg for a protractor, 1 pixel in an image, etc...). At step further, two numerical values can be considered as distinct only if they differ by more than 2 steps (we have to double the value of the bound because each value may vary within one step), otherwise they are indistinguishable. This allows to reject ill-defined definitions.


Field Summary
 
Fields inherited from class imp.core.Value
NULL
 
Method Summary
 double getBound()
          Gets the bound B such that |z|<B for a rescaled value z.
 double getDefaultValue()
          Gets the measure default-value.
 double getMax()
          Gets the measure maximum.
 double getMin()
          Gets the measure minimum.
 String getName()
          Gets the measure name.
 double getRescaledValue(double value)
          Gets a rescaled value of step 1 and such that |z|<B, B being the bound.
static double[] getRescaledValue(Measure[] measures, double[] values)
          Gets a rescaled values from an array of measure and the corresponding values.
 double getStep()
          Gets the measure step.
 String getUnit()
          Gets the measure unit.
 double getValue()
          Gets the measure value.
 Measure setDefaultValue(double value)
          Sets the measure default-value, default is 0, and return this.
 Measure setMax(double max)
          Sets the measure maximum, default is +huge, and return this.
 Measure setMin(double min)
          Sets the measure minimum, default is -huge, and return this.
 Measure setName(String name)
          Sets the measure name, default is "", and return this.
 Measure setStep(double step)
          Sets the measure step, default is 1 minimal value is 1e-12, and return this.
 Measure setUnit(String unit)
          Sets the measure unit, default is "" and return this.
 Measure setValue(double value)
          Sets the measure value, default is 0, and return this.
 Measure setValue(String measure)
          Sets this measure, parsing the given string, and return this.
 String stringValue()
          Gets this measure as a string.
 
Methods inherited from class imp.core.Value
add, cloneThis, create, elements, fields, get, getType, getWrapping, isCyclic, isName, length, load, main, save, set, toString, wrappedObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getBound

public double getBound()
Gets the bound B such that |z|<B for a rescaled value z.


getDefaultValue

public double getDefaultValue()
Gets the measure default-value.


getMax

public double getMax()
Gets the measure maximum.


getMin

public double getMin()
Gets the measure minimum.


getName

public String getName()
Gets the measure name.


getRescaledValue

public double getRescaledValue(double value)
Gets a rescaled value of step 1 and such that |z|<B, B being the bound.

Parameters:
value - The raw value to be rescaled and centered, default is this measure value.

getRescaledValue

public static double[] getRescaledValue(Measure[] measures,
                                        double[] values)
Gets a rescaled values from an array of measure and the corresponding values.


getStep

public double getStep()
Gets the measure step.


getUnit

public String getUnit()
Gets the measure unit.


getValue

public double getValue()
Gets the measure value.


setDefaultValue

public Measure setDefaultValue(double value)
Sets the measure default-value, default is 0, and return this.


setMax

public Measure setMax(double max)
Sets the measure maximum, default is +huge, and return this.


setMin

public Measure setMin(double min)
Sets the measure minimum, default is -huge, and return this.


setName

public Measure setName(String name)
Sets the measure name, default is "", and return this.


setStep

public Measure setStep(double step)
Sets the measure step, default is 1 minimal value is 1e-12, and return this.


setUnit

public Measure setUnit(String unit)
Sets the measure unit, default is "" and return this.


setValue

public Measure setValue(double value)
Sets the measure value, default is 0, and return this.


setValue

public Measure setValue(String measure)
Sets this measure, parsing the given string, and return this.

Parameters:
measure - A string of the form $name:$value|$default@$min..$max#$step$unit.
Throws:
IllegalArgumentException - if the value is not valid.

stringValue

public String stringValue()
Gets this measure as a string.

Overrides:
stringValue in class Value
Returns:
The value (i.e. the field of name value) of this object as a string or "" if the object is not defined by its value.