aivika-6.0.0: A multi-method simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Statistics

Description

Tested with: GHC 8.0.1

Represents statistics.

Synopsis

Simple Statistics

data SamplingStats a Source #

Describes when the statistics consists of only samples not bound to the simulation time.

Constructors

SamplingStats 

Fields

Instances

Instances details
ResultItemable (ResultValue (SamplingStats Double)) Source # 
Instance details

Defined in Simulation.Aivika.Results

Methods

resultItemName :: ResultValue (SamplingStats Double) -> ResultName Source #

resultItemNamePath :: ResultValue (SamplingStats Double) -> [ResultName] Source #

resultItemId :: ResultValue (SamplingStats Double) -> ResultId Source #

resultItemIdPath :: ResultValue (SamplingStats Double) -> [ResultId] Source #

resultItemSignal :: ResultValue (SamplingStats Double) -> ResultSignal Source #

resultItemExpansion :: ResultValue (SamplingStats Double) -> ResultSource Source #

resultItemSummary :: ResultValue (SamplingStats Double) -> ResultSource Source #

resultItemAsIntValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue Int) Source #

resultItemAsIntListValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue [Int]) Source #

resultItemAsIntStatsValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue (SamplingStats Int)) Source #

resultItemAsIntTimingStatsValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue (TimingStats Int)) Source #

resultItemAsDoubleValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue Double) Source #

resultItemAsDoubleListValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue [Double]) Source #

resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue (SamplingStats Double)) Source #

resultItemAsDoubleTimingStatsValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue (TimingStats Double)) Source #

resultItemAsStringValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue String) Source #

ResultItemable (ResultValue (SamplingStats Int)) Source # 
Instance details

Defined in Simulation.Aivika.Results

SamplingData a => Monoid (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

SamplingData a => Semigroup (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Generic (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (SamplingStats a) :: Type -> Type #

Show a => Show (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Binary a => Binary (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: SamplingStats a -> () #

Eq a => Eq (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingStats a) = D1 ('MetaData "SamplingStats" "Simulation.Aivika.Statistics" "aivika-6.0.0-Hbbn1fddNCK5MgLRSpqmMf" 'False) (C1 ('MetaCons "SamplingStats" 'PrefixI 'True) ((S1 ('MetaSel ('Just "samplingStatsCount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "samplingStatsMin") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "samplingStatsMax") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: (S1 ('MetaSel ('Just "samplingStatsMean") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "samplingStatsMean2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))))

combineSamplingStatsEither :: SamplingData a => Either a (SamplingStats a) -> SamplingStats a -> SamplingStats a Source #

If allows combining statistics more efficiently if we know that the first argument can be a scalar.

samplingStatsVariance :: SamplingStats a -> Double Source #

Return the variance.

samplingStatsDeviation :: SamplingStats a -> Double Source #

Return the deviation.

samplingStatsSummary :: Show a => SamplingStats a -> Int -> ShowS Source #

Show the summary of the statistics using the specified indent.

returnSamplingStats :: SamplingData a => a -> SamplingStats a Source #

Return the statistics by a single sample.

listSamplingStats :: SamplingData a => [a] -> SamplingStats a Source #

Create the statistics by the specified list of data.

fromIntSamplingStats :: SamplingStats Int -> SamplingStats Double Source #

Convert the statistics from integer to double values.

Timing Statistics

data TimingStats a Source #

This is the timing statistics where data are bound to the time.

Constructors

TimingStats 

Fields

Instances

Instances details
ResultItemable (ResultValue (TimingStats Double)) Source # 
Instance details

Defined in Simulation.Aivika.Results

ResultItemable (ResultValue (TimingStats Int)) Source # 
Instance details

Defined in Simulation.Aivika.Results

Generic (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (TimingStats a) :: Type -> Type #

Methods

from :: TimingStats a -> Rep (TimingStats a) x #

to :: Rep (TimingStats a) x -> TimingStats a #

(Show a, TimingData a) => Show (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Binary a => Binary (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

put :: TimingStats a -> Put #

get :: Get (TimingStats a) #

putList :: [TimingStats a] -> Put #

NFData a => NFData (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: TimingStats a -> () #

Eq a => Eq (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (TimingStats a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (TimingStats a) = D1 ('MetaData "TimingStats" "Simulation.Aivika.Statistics" "aivika-6.0.0-Hbbn1fddNCK5MgLRSpqmMf" 'False) (C1 ('MetaCons "TimingStats" 'PrefixI 'True) (((S1 ('MetaSel ('Just "timingStatsCount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "timingStatsMin") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "timingStatsMax") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: (S1 ('MetaSel ('Just "timingStatsLast") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "timingStatsMinTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))) :*: ((S1 ('MetaSel ('Just "timingStatsMaxTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "timingStatsStartTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "timingStatsLastTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: (S1 ('MetaSel ('Just "timingStatsSum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "timingStatsSum2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double))))))

class Num a => TimingData a where Source #

Defines the data type from which values we can gather the timing statistics.

Methods

emptyTimingStats :: TimingStats a Source #

An empty statistics that has no samples.

addTimingStats :: Double -> a -> TimingStats a -> TimingStats a Source #

Add a sample with the specified time to the statistics.

timingStatsMean :: TimingStats a -> Double Source #

Return the average value.

timingStatsMean2 :: TimingStats a -> Double Source #

Return the average square value.

timingStatsVariance :: TimingStats a -> Double Source #

Return the variance.

timingStatsDeviation :: TimingData a => TimingStats a -> Double Source #

Return the deviation.

timingStatsSummary :: (Show a, TimingData a) => TimingStats a -> Int -> ShowS Source #

Show the summary of the statistics using the specified indent.

returnTimingStats :: TimingData a => Double -> a -> TimingStats a Source #

Return the statistics by single timing data.

fromIntTimingStats :: TimingStats Int -> TimingStats Double Source #

Convert the statistics from integer to double values.

normTimingStats :: TimingData a => Int -> TimingStats a -> SamplingStats a Source #

Convert the statistics to its normalised sampling-based representation, where the first argument specifies the number of pseudo-samples.

Simple Counter

data SamplingCounter a Source #

A counter for which the statistics is collected too.

Constructors

SamplingCounter 

Fields

Instances

Instances details
(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Dynamics (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Event (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Parameter (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Simulation (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Signalable (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Var (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

Generic (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (SamplingCounter a) :: Type -> Type #

Show a => Show (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Binary a => Binary (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: SamplingCounter a -> () #

Eq a => Eq (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingCounter a) = D1 ('MetaData "SamplingCounter" "Simulation.Aivika.Statistics" "aivika-6.0.0-Hbbn1fddNCK5MgLRSpqmMf" 'False) (C1 ('MetaCons "SamplingCounter" 'PrefixI 'True) (S1 ('MetaSel ('Just "samplingCounterValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "samplingCounterStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SamplingStats a))))

incSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a Source #

Increase the counter.

decSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a Source #

Decrease the counter.

setSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a Source #

Set a new value for the counter.

returnSamplingCounter :: SamplingData a => a -> SamplingCounter a Source #

Create a counter with the specified initial value.

Timing Counter

data TimingCounter a Source #

A counter for which the timing statistics is collected too.

Constructors

TimingCounter 

Fields

Instances

Instances details
(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Dynamics (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Event (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Parameter (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Simulation (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Signalable (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Var (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

Generic (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (TimingCounter a) :: Type -> Type #

(Show a, TimingData a) => Show (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Binary a => Binary (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: TimingCounter a -> () #

Eq a => Eq (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (TimingCounter a) Source # 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (TimingCounter a) = D1 ('MetaData "TimingCounter" "Simulation.Aivika.Statistics" "aivika-6.0.0-Hbbn1fddNCK5MgLRSpqmMf" 'False) (C1 ('MetaCons "TimingCounter" 'PrefixI 'True) (S1 ('MetaSel ('Just "timingCounterValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "timingCounterStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TimingStats a))))

incTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source #

Increase the counter at the specified time.

decTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source #

Decrease the counter at the specified time.

setTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source #

Set a new value for the counter at the specified time.

returnTimingCounter :: TimingData a => Double -> a -> TimingCounter a Source #

Create a timing counter with the specified initial value at the given time.