|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
ptolemy.actor.lib.RandomSource
ptolemy.actor.lib.colt.ColtRandomSource
ptolemy.actor.lib.colt.ColtBinomial
public class ColtBinomial
Produce a random sequence with a Binomial distribution. On each iteration, a new random number is produced. The output port is of type DoubleToken. The values that are generated are independent and identically distributed with the mean and the standard deviation given by parameters. In addition, the seed can be specified as a parameter to control the sequence that is generated.
This actor instantiates a
cern.jet.random.Binomial object with
n, the number of trials (also known as the sample size) set to 1
and p, the probability of success, set to 0.5.
A definition of Binomial by Wolfgang Hoschek can be found at
http://hoschek.home.cern.ch/hoschek/colt/V1.0.3/doc/cern/jet/stat/Probability.html#binomial(int,%20int,%20double)
:
The above description of binomial() is copyrighted.binomial
public static double binomial(int k, int n, double p)Returns the sum of the terms 0 through k of the Binomial probability density.
k -- ( n ) j n-j > ( ) p (1-p) -- ( j ) j=0The terms are not summed directly; instead the incomplete beta integral is employed, according to the formulay = binomial( k, n, p ) = Gamma.incompleteBeta( n-k, k+1, 1-p ).
All arguments must be positive,
Parameters:
k
- end term.n
- the number of trials.p
- the probability of success (must be in (0.0,1.0)).
Red (cxh) |
Red (cxh) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private int |
_current
The random number for the current iteration. |
private cern.jet.random.Binomial |
_generator
The random number generator. |
PortParameter |
n
n. |
PortParameter |
p
p. |
Fields inherited from class ptolemy.actor.lib.colt.ColtRandomSource |
---|
_randomNumberGenerator, generatorClass |
Fields inherited from class ptolemy.actor.lib.RandomSource |
---|
_generatorSeed, _needNew, _needNewGenerator, _random, resetOnEachRun, seed |
Fields inherited from class ptolemy.actor.lib.Source |
---|
output, trigger |
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 | |
---|---|
ColtBinomial(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name. |
Method Summary | |
---|---|
protected void |
_createdNewRandomNumberGenerator()
Method that is called after _randomNumberGenerator is changed. |
protected void |
_generateRandomNumber()
Generate a new random number. |
void |
fire()
Send a random number with a Binomial distribution to the output. |
Methods inherited from class ptolemy.actor.lib.colt.ColtRandomSource |
---|
_createGenerator, attributeChanged |
Methods inherited from class ptolemy.actor.lib.RandomSource |
---|
clone, initialize, postfire |
Methods inherited from class ptolemy.actor.lib.Source |
---|
prefire |
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, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, 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 |
---|
public PortParameter n
public PortParameter p
private int _current
private cern.jet.random.Binomial _generator
Constructor Detail |
---|
public ColtBinomial(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 fire() throws IllegalActionException
fire
in interface Executable
fire
in class RandomSource
IllegalActionException
- If there is no director.protected void _createdNewRandomNumberGenerator()
_createdNewRandomNumberGenerator
in class ColtRandomSource
protected void _generateRandomNumber() throws IllegalActionException
_generateRandomNumber
in class RandomSource
IllegalActionException
- If parameter values are incorrect.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |