|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.util.LogMath
public final class LogMath
Provides a set of methods for performing simple math in the log domain. The logarithmic base can be set by the
SphinxProperty:
edu.cmu.sphinx.util.LogMath.logBase
Field Summary | |
---|---|
static java.lang.String |
PROP_LOG_BASE
Sphinx property to get the Log base. |
static java.lang.String |
PROP_USE_ADD_TABLE
Sphinx property that controls whether we use the old, slow (but correct) method of performing the LogMath.add by doing the actual computation. |
Constructor Summary | |
---|---|
LogMath()
|
Method Summary | |
---|---|
float |
addAsLinear(float logVal1,
float logVal2)
Returns the summation of two numbers when the arguments and the result are in log. |
static void |
clearInstance()
Resets the singelton instance kept by this class. |
static LogMath |
getInstance()
Returns the last created instance of LogMath or a default instance using all default parameters. |
float |
getLogBase()
Returns the actual log base. |
static float |
getLogOne()
Returns the one value in the log domain |
static float |
getLogZero()
Returns the zero value in the log domain |
boolean |
isUseAddTable()
|
float |
linearToLog(double linearValue)
Converts the value from linear scale to log scale. |
static float[] |
linearToLog(float[] vector,
LogMath logMath)
Converts a vector from linear domain to logdomain using a given LogMath -instance for conversion. |
float |
lnToLog(float logSource)
Converts the source, which is a number in base Math.E, to a log value which base is the LogBase of this LogMath. |
static float |
log10(float value)
Returns the log (base 10) of value |
float |
log10ToLog(float logSource)
Converts the source, which is a number in base 10, to a log value which base is the LogBase of this LogMath. |
double |
logToLinear(float logValue)
Converts the value from log scale to linear scale. |
static double[] |
logToLinear(float[] vector,
LogMath logMath)
Converts a vector from log to linear domain using a given LogMath -instance for conversion. |
float |
logToLn(float logSource)
Converts the source, whose base is the LogBase of this LogMath, to a log value which is a number in base Math.E. |
static float |
logToLog(float logSource,
float sourceBase,
float resultBase)
Converts the source, which is assumed to be a log value whose base is sourceBase, to a log value whose base is resultBase. |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured. |
float |
subtractAsLinear(float logMinuend,
float logSubtrahend)
Returns the difference between two numbers when the arguments and the result are in log. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@S4Double(defaultValue=1.0001) public static final java.lang.String PROP_LOG_BASE
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_USE_ADD_TABLE
Constructor Detail |
---|
public LogMath()
Method Detail |
---|
public static LogMath getInstance()
LogMath
or a default instance using all default parameters.
public static void clearInstance()
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
ps
- a property sheet holding the new data
PropertyException
- if there is a problem with the properties.public final float addAsLinear(float logVal1, float logVal2)
subtractAsLinear(a, b)
is *not* the same as
addAsLinear(a, -b)
, since we're in the log domain, and -b is in fact the inverse. No
underflow/overflow check is performed.
logVal1
- value in log domain (i.e. log(val1)) to addlogVal2
- value in log domain (i.e. log(val2)) to add
public final float subtractAsLinear(float logMinuend, float logSubtrahend) throws java.lang.IllegalArgumentException
logMinuend
- value in log domain (i.e. log(minuend)) to be subtracted fromlogSubtrahend
- value in log domain (i.e. log(subtrahend)) that is being subtracted
java.lang.IllegalArgumentException
- This is a very slow way to do this, but this method should rarely be used.
public static float logToLog(float logSource, float sourceBase, float resultBase) throws java.lang.IllegalArgumentException
logSource
- log value whose base is sourceBasesourceBase
- the base of the log the sourceresultBase
- the base to convert the source log to
java.lang.IllegalArgumentException
public final float lnToLog(float logSource)
logSource
- the number in base Math.E to convertpublic final float log10ToLog(float logSource)
logSource
- the number in base Math.E to convertpublic final float logToLn(float logSource)
logSource
- the number to convert to base Math.Epublic final float linearToLog(double linearValue) throws java.lang.IllegalArgumentException
linearValue
- the value to be converted to log scale
java.lang.IllegalArgumentException
public final double logToLinear(float logValue)
logValue
- the value to be converted to the linear scale
public static float getLogZero()
public static float getLogOne()
public final float getLogBase()
public boolean isUseAddTable()
public static float log10(float value)
value
- the value to take the log of
public static float[] linearToLog(float[] vector, LogMath logMath)
LogMath
-instance for conversion.
public static double[] logToLinear(float[] vector, LogMath logMath)
LogMath
-instance for conversion.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |