|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.kernel.util.NamedObj ptolemy.kernel.InstantiableNamedObj ptolemy.kernel.Entity ptolemy.kernel.ComponentEntity ptolemy.actor.AtomicActor ptolemy.actor.TypedAtomicActor ptolemy.domains.sdf.lib.SDFTransformer ptolemy.backtrack.automatic.ptolemy.domains.sdf.lib.Autocorrelation
public class Autocorrelation
This actor calculates the autocorrelation of a sequence of input tokens. It is polymorphic, supporting any input data type that supports multiplication, addition, and division by an integer. However, since integer division will lose the fractional portion of the result, type resolution will resolve the input type to double or double matrix if the input port is connected to an integer or integer matrix source, respectively.
Both biased and unbiased autocorrelation estimates are supported. If the parameter biased is true, then the autocorrelation estimate is
N-1-k 1 --- r(k) = - \ x(n)x(n+k) N / --- n=0for k = 0, ... , p, where N is the number of inputs to average (numberOfInputs), p is the number of lags to estimate (numberOfLags), and x* is the conjugate of the input (if it is complex). This estimate is biased because the outermost lags have fewer than N terms in the summation, and yet the summation is still normalized by N.
If the parameter biased is false (the default), then the estimate is
N-1-k 1 --- r(k) = --- \ x(n)x(n+k) N-k / --- n=0In this case, the estimate is unbiased. However, note that the unbiased estimate does not guarantee a positive definite sequence, so a power spectral estimate based on this autocorrelation estimate may have negative components.
The output will be an array of tokens whose type is at least that of the input. If the parameter symmetricOutput is true, then the output will be symmetric and have length equal to twice the number of lags requested plus one. Otherwise, the output will have length equal to twice the number of lags requested, which will be almost symmetric (insert the last sample into the first position to get the symmetric output that you would get with the symmetricOutput being true).
Yellow (neuendor) |
Green (eal) |
Nested Class Summary | |
---|---|
private static class |
Autocorrelation.FunctionTerm
|
private class |
Autocorrelation.OutputTypeTerm
Monotonic function that determines the type of the output port. |
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private int |
_lengthOfOutput
|
private int |
_numberOfInputs
|
private int |
_numberOfLags
|
private Token[] |
_outputs
|
private boolean |
_symmetricOutput
|
protected Checkpoint |
$CHECKPOINT
|
private FieldRecord |
$RECORD$_lengthOfOutput
|
private FieldRecord |
$RECORD$_numberOfInputs
|
private FieldRecord |
$RECORD$_numberOfLags
|
private FieldRecord |
$RECORD$_outputs
|
private FieldRecord |
$RECORD$_symmetricOutput
|
protected CheckpointRecord |
$RECORD$$CHECKPOINT
|
private FieldRecord[] |
$RECORDS
|
Parameter |
biased
If true, the estimate will be biased. |
Parameter |
numberOfInputs
Number of input samples to average. |
Parameter |
numberOfLags
Number of autocorrelation lags to output. |
Parameter |
symmetricOutput
If true, then the output from each firing will have 2*numberOfLags + 1 samples (an odd number) whose values are symmetric about the midpoint. |
Fields inherited from class ptolemy.domains.sdf.lib.SDFTransformer |
---|
input, input_tokenConsumptionRate, output, output_tokenInitProduction, output_tokenProductionRate |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
Autocorrelation(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name. |
Method Summary | |
---|---|
private int |
$ASSIGN$_lengthOfOutput(int newValue)
|
private int |
$ASSIGN$_numberOfInputs(int newValue)
|
private int |
$ASSIGN$_numberOfLags(int newValue)
|
private Token |
$ASSIGN$_outputs(int index0,
Token newValue)
|
private Token[] |
$ASSIGN$_outputs(Token[] newValue)
|
private boolean |
$ASSIGN$_symmetricOutput(boolean newValue)
|
private Token[] |
$BACKUP$_outputs()
|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes made at timestamp and afterward. |
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object. |
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable object. |
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object. |
void |
attributeChanged(Attribute attribute)
Check to see that the numberOfInputs parameter is positive, and that the numberOfLags parameter is positive. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Consume tokens from the input and produce a token on the output that contains an array token that represents an autocorrelation estimate of the consumed tokens. |
boolean |
prefire()
If there are not sufficient inputs, then return false. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.actor.Actor |
---|
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, isStrict, iterate, postfire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, initialize, preinitialize, removeInitializable, wrapup |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
protected transient Checkpoint $CHECKPOINT
public Parameter biased
public Parameter numberOfInputs
public Parameter numberOfLags
public Parameter symmetricOutput
private int _numberOfInputs
private int _numberOfLags
private int _lengthOfOutput
private boolean _symmetricOutput
private Token[] _outputs
protected transient CheckpointRecord $RECORD$$CHECKPOINT
private transient FieldRecord $RECORD$_numberOfInputs
private transient FieldRecord $RECORD$_numberOfLags
private transient FieldRecord $RECORD$_lengthOfOutput
private transient FieldRecord $RECORD$_symmetricOutput
private transient FieldRecord $RECORD$_outputs
private transient FieldRecord[] $RECORDS
Constructor Detail |
---|
public Autocorrelation(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.
IllegalActionException
- If the actor cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that has changed.
IllegalActionException
- If the parameters are out of range.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class AtomicActor
workspace
- The workspace for the new object.
java.lang.CloneNotSupportedException
- If a derived class has
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor
IllegalActionException
- If there is no director.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class SDFTransformer
IllegalActionException
- If the base class throws it.private final int $ASSIGN$_numberOfInputs(int newValue)
private final int $ASSIGN$_numberOfLags(int newValue)
private final int $ASSIGN$_lengthOfOutput(int newValue)
private final boolean $ASSIGN$_symmetricOutput(boolean newValue)
private final Token[] $ASSIGN$_outputs(Token[] newValue)
private final Token $ASSIGN$_outputs(int index0, Token newValue)
private final Token[] $BACKUP$_outputs()
public void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
timestamp
- The timestamp.public void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
public final Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Rollbackable
public final java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Rollbackable
checkpoint
- The new checkpoint object.
Checkpoint.setCheckpoint(Checkpoint)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |