etomica.data
Class AccumulatorAverageCollapsing
java.lang.Object
etomica.data.DataProcessor
etomica.data.DataProcessorForked
etomica.data.DataAccumulator
etomica.data.AccumulatorAverage
etomica.data.AccumulatorAverageCollapsing
- All Implemented Interfaces:
- DataPipe, DataPipeForked, IDataSink, IDataSource, IEtomicaDataSource, Serializable
public class AccumulatorAverageCollapsing
- extends AccumulatorAverage
AccumulatorAverage that adjusts the block size during the simulation. When
a certain number of blocks of data have been collected, the blocks are
collapsed such that each new block contains the data from two of the old
blocks. 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.
- See Also:
- Serialized Form
|
Method Summary |
void |
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()
Returns a DataGroup with Data instances holding the statistics kept by
this accumulator (as described in general comments for this class). |
DataPipe |
getDataCaster(IEtomicaDataInfo incomingDataInfo)
Checks that incoming Data implements Data, and returns null if
this is so. |
int |
getMaxBlocks()
|
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)
|
maxBlocks
protected int maxBlocks
blockSums
protected double[] blockSums
currentBlockSum
protected double currentBlockSum
totalSumSquare
protected double totalSumSquare
totalSumBlockSq
protected double totalSumBlockSq
correlationSum
protected double correlationSum
totalBlockSum
protected double totalBlockSum
nominalBlockSize
protected long nominalBlockSize
AccumulatorAverageCollapsing
public AccumulatorAverageCollapsing()
- Default constructor sets block size to Default value, and sets the
interval for pushing the output data (pushInterval) to 100.
AccumulatorAverageCollapsing
public AccumulatorAverageCollapsing(int maxBlocks)
AccumulatorAverageCollapsing
public AccumulatorAverageCollapsing(int maxBlocks,
int blockSize)
setMaxBlocks
public void setMaxBlocks(int newMaxBlocks)
getMaxBlocks
public int getMaxBlocks()
getDataCaster
public DataPipe getDataCaster(IEtomicaDataInfo incomingDataInfo)
- Checks that incoming Data implements Data, and returns null if
this is so. Otherwise throws a ClassCastException, as there is no data
caster to Data.
- Parameters:
incomingDataInfo - the DataInfo for the Data that will fed to the sink's putData method
addData
public void addData(IData data)
- Add the given values to the sums and block sums. If any of the given data
values is NaN, method returns with no effect on accumulation sums.
- Specified by:
addData in class DataAccumulator
doBlockSum
protected void doBlockSum()
- Performs the block sum after blockSize calls to addData.
collapseBlocks
protected void collapseBlocks()
getData
public IData getData()
- Returns a DataGroup with Data instances holding the statistics kept by
this accumulator (as described in general comments for this class).
- Specified by:
getData in interface IDataSource- Specified by:
getData in class DataAccumulator
- Returns:
- the data given by this source
reset
public void reset()
- Resets all sums to zero. All statistics are cleared.
- Overrides:
reset in class AccumulatorAverage
setBlockSize
public void setBlockSize(long newBlockSize)
- Sets the size of the block used to group data for error analysis. Resets
statistics accumulated so far. Default is 1.
- Overrides:
setBlockSize in class AccumulatorAverage
- Parameters:
blockSize - new block size.