Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

ptolemy.math
Class FixPointQuantization

java.lang.Object
 extended byptolemy.math.Quantization
 extended byptolemy.math.FixPointQuantization
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class FixPointQuantization
extends Quantization

The FixPointQuantization class defines the mapping of numeric values with unlimited precision to the finite precision supported by arithmetic using the FixPoint class.

It comprises a

The active class functionality is provided by the quantize method, which is normally invoked from FixPoint.quantize to enforce quantization constraints upon the result of an unconstrained computation.

An instance of the class is immutable, meaning that its value is set in the constructor and cannot then be modified.

Since:
Ptolemy II 2.1
Version:
$Id: FixPointQuantization.java,v 1.26 2006年02月07日 00:48:59 cxh Exp $
Author:
Ed Willink
See Also:
FixPoint, Precision, Overflow, Rounding, Serialized Form
Accepted Rating:
Red
Proposed Rating:
Red (Ed.Willink)

Field Summary
protected Precision _precision
The precision.
Fields inherited from class ptolemy.math.Quantization
_overflow, _rounding
Constructor Summary
FixPointQuantization(Precision precision, Overflow overflow, Rounding rounding)
Construct a FixPointQuantization with specified precision, overflow and rounding.
FixPointQuantization(java.lang.String string)
Construct a FixPointQuantization object based on the provided string.
Method Summary
boolean equals(java.lang.Object object)
Return true if the given object describes the same mapping to quantized values as this object.
Precision getMantissaPrecision()
Return the precision of the mantissa of the value.
Precision getPrecision()
Return the precision.
FixPointQuantization setOverflow(Overflow overflow)
Return a FixPointQuantization with a changed overflow strategy.
FixPointQuantization setPrecision(Precision precision)
Return a FixPointQuantization with a changed precision.
FixPointQuantization setRounding(Rounding rounding)
Return a FixPointQuantization with a changed rounding strategy.
java.lang.String toString()
Return a string representing this quantization.
Methods inherited from class ptolemy.math.Quantization
clone, getEpsilonValue, getExactOverflow, getExactRounding, getExponentBitLength, getFractionBitLength, getIntegerBitLength, getMantissaBitLength, getMaximumUnscaledValue, getMaximumValue, getMinimumUnscaledValue, getMinimumValue, getModuloUnscaledValue, getNumberOfBits, getNumberOfLevels, getOverflow, getRounding, getTinyValue
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

_precision

protected Precision _precision
The precision.

Constructor Detail

FixPointQuantization

public FixPointQuantization(java.lang.String string)
 throws java.lang.IllegalArgumentException
Construct a FixPointQuantization object based on the provided string. The string may consist of just precision or precision, overflow or precision, overflow, rounding, and may optionally be enclosed in parentheses.

precision must be one of the Precision formats; integer-bits.fraction-bits or total-bits/integer-bits.

overflow must be one of the Overflow strategies; e.g. saturate or modulo or trap. The default is saturate.

rounding must be one of the Rounding strategies; e.g. up or half_even or unnecessary. The default is nearest.

Parameters:
string - The string representing the quantization specification.
Throws:
java.lang.IllegalArgumentException - If the precision string supplied, overflow strategy or rounding strategy does not match one of the known formats.

FixPointQuantization

public FixPointQuantization(Precision precision,
 Overflow overflow,
 Rounding rounding)
Construct a FixPointQuantization with specified precision, overflow and rounding.

Parameters:
precision - The precision.
overflow - The overflow.
rounding - The rounding.
Method Detail

equals

public boolean equals(java.lang.Object object)
Return true if the given object describes the same mapping to quantized values as this object.

Overrides:
equals in class Quantization
Parameters:
object - The FixPointQuantization object to use for equality checking.
Returns:
True if the quantizations are equal.

getMantissaPrecision

public Precision getMantissaPrecision()
Return the precision of the mantissa of the value.

Specified by:
getMantissaPrecision in class Quantization
Returns:
The precision.

getPrecision

public Precision getPrecision()
Return the precision.

Specified by:
getPrecision in class Quantization
Returns:
Precision object.
See Also:
setPrecision(Precision)

setOverflow

public FixPointQuantization setOverflow(Overflow overflow)
Return a FixPointQuantization with a changed overflow strategy.

Parameters:
overflow - The new overflow strategy.
Returns:
A new quantization.

setPrecision

public FixPointQuantization setPrecision(Precision precision)
Return a FixPointQuantization with a changed precision.

Parameters:
precision - The new precision.
Returns:
A new quantization.
See Also:
getPrecision()

setRounding

public FixPointQuantization setRounding(Rounding rounding)
Return a FixPointQuantization with a changed rounding strategy.

Parameters:
rounding - The new rounding.strategy.
Returns:
A new quantization.

toString

public java.lang.String toString()
Return a string representing this quantization. The string is expressed as "(m.n, o, p)", where m indicates the number of integer bits, n represents the number of fractional bits and o represents the overflow strategy and r represents the rounding strategy.

Specified by:
toString in class Quantization
Returns:
A string representing this quantization.

Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

AltStyle によって変換されたページ (->オリジナル) /