DataPipe
, DataPipeForked
, IDataSink
, IDataSource
public class AccumulatorAverageCollapsing extends AccumulatorAverage
This allows the accumulator to yield reasonable estimates of the average and uncertainty during the beginning of the simulation and still produce accurate estimates of the uncertainty for longer simulation runs.
This accumulator can only operate on Data with a single value.
AccumulatorAverage.StatType
Modifier and Type | Field | Description |
---|---|---|
protected double[] |
blockAvgs |
|
protected double |
correlationSum |
|
protected double |
currentBlockAvg |
|
protected int |
maxBlocks |
|
protected long |
nominalBlockSize |
|
protected double |
totalAvg |
|
protected double |
totalBlockAvg |
|
protected double |
totalBlockVarSum |
|
protected double |
totalSumSquare |
|
protected double |
totalVarSum |
average, AVERAGE, BLOCK_CORRELATION, blockCorrelation, blockCountDown, blockSize, count, dataGroup, doIncludeACInError, error, ERROR, MOST_RECENT, mostRecent, STANDARD_DEVIATION, standardDeviation
active, hasUnpushedData, pushInterval, putCount
dataInfo, dataSink, tag
Constructor | Description |
---|---|
AccumulatorAverageCollapsing() |
Default constructor sets the maximum number of blocks (maxBlocks) to a default value of 20,
the initial block size (blockSize) to 1 and the interval for pushing the output data (pushInterval)
to 100.
|
AccumulatorAverageCollapsing(int maxBlocks) |
Constructor with default pushInterval of 100 and initial blockSize of 1.
|
AccumulatorAverageCollapsing(int maxBlocks,
int blockSize) |
Constructor with default pushInterval of 100.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
addData(IData data) |
Add the given values to the sums and block sums.
|
protected void |
collapseBlocks() |
|
protected void |
doBlockSum() |
Performs the block sum after blockSize calls to addData.
|
IData |
getData() |
|
int |
getMaxBlocks() |
|
IDataInfo |
processDataInfo(IDataInfo incomingDataInfo) |
Prepares the accumulator for input data.
|
void |
reset() |
Resets all sums to zero.
|
void |
setBlockSize(long newBlockSize) |
Sets the size of the block used to group data for error analysis.
|
void |
setMaxBlocks(int newMaxBlocks) |
Changes the maximum number of blocks.
|
addDataSink, doIncludeACInError, getBlockCount, getBlockSize, getData, getSampleCount, getTag, setIncludeACInError, statChoices
getPushInterval, isActive, processData, setActive, setPushInterval, toString
getDataInfo, getTag, putData, putDataInfo
addDataSink, getDataSink, getDataSinks, removeDataSink, setDataSink, setDataSinks
putData, putDataInfo
getDataInfo, getTag
protected int maxBlocks
protected double[] blockAvgs
protected double currentBlockAvg
protected double totalSumSquare
protected double totalBlockVarSum
protected double totalVarSum
protected double correlationSum
protected double totalBlockAvg
protected double totalAvg
protected long nominalBlockSize
public AccumulatorAverageCollapsing()
public AccumulatorAverageCollapsing(int maxBlocks)
maxBlocks
- the largest number of blocks. Adding new data beyond this triggers
collapsing of blockspublic AccumulatorAverageCollapsing(int maxBlocks, int blockSize)
maxBlocks
- the largest number of blocks. Adding new data beyond this triggers
collapsing of blocksblockSize
- the initial number of terms that contribute to each block. Doubles
with each collapse of the blocks.public int getMaxBlocks()
public void setMaxBlocks(int newMaxBlocks)
newMaxBlocks
- new value for maxBlocksjava.lang.RuntimeException
- if newMaxBlocks is less than 4 or an odd number.public IDataInfo processDataInfo(IDataInfo incomingDataInfo)
AccumulatorAverage
processDataInfo
in class AccumulatorAverage
incomingDataInfo
- the DataInfo instance for the data that will be given to
addDatapublic boolean addData(IData data)
addData
in class DataAccumulator
data
- Data to be added.protected void doBlockSum()
protected void collapseBlocks()
public IData getData()
getData
in interface IDataSource
getData
in class DataAccumulator
public void reset()
reset
in class AccumulatorAverage
public void setBlockSize(long newBlockSize)
setBlockSize
in class AccumulatorAverage
newBlockSize
- new block size.