A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
Functions/Subroutines | Variables
stat Module Reference

Statistics accumulators. More...

Functions/Subroutines

subroutine, public init_stat
 Initialise the accumulators. More...
 
subroutine, public acc (x)
 Accumulate one state. More...
 
real(kind=8) function, dimension(0:ndim), public mean ()
 Function returning the mean. More...
 
real(kind=8) function, dimension(0:ndim), public var ()
 Function returning the variance. More...
 
integer function, public iter ()
 Function returning the number of data accumulated. More...
 
subroutine, public reset
 Routine resetting the accumulators. More...
 

Variables

integer i =0
 Number of stats accumulated. More...
 
real(kind=8), dimension(:), allocatable m
 Vector storing the inline mean. More...
 
real(kind=8), dimension(:), allocatable mprev
 Previous mean vector. More...
 
real(kind=8), dimension(:), allocatable v
 Vector storing the inline variance. More...
 
real(kind=8), dimension(:), allocatable mtmp
 

Detailed Description

Statistics accumulators.

Function/Subroutine Documentation

subroutine, public stat::acc ( real(kind=8), dimension(0:ndim), intent(in)  x)

Accumulate one state.

Definition at line 48 of file stat.f90.

48  IMPLICIT NONE
49  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: x
50  i=i+1
51  mprev=m+(x-m)/i
52  mtmp=mprev
53  mprev=m
54  m=mtmp
55  v=v+(x-mprev)*(x-m)
subroutine, public stat::init_stat ( )

Initialise the accumulators.

Definition at line 35 of file stat.f90.

35  INTEGER :: allocstat
36 
37  ALLOCATE(m(0:ndim),mprev(0:ndim),v(0:ndim),mtmp(0:ndim), stat=allocstat)
38  IF (allocstat /= 0) stop '*** Not enough memory ***'
39  m=0.d0
40  mprev=0.d0
41  v=0.d0
42  mtmp=0.d0
43 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14
integer function, public stat::iter ( )

Function returning the number of data accumulated.

Definition at line 72 of file stat.f90.

72  INTEGER :: iter
73  iter=i
real(kind=8) function, dimension(0:ndim), public stat::mean ( )

Function returning the mean.

Definition at line 60 of file stat.f90.

60  REAL(KIND=8), DIMENSION(0:ndim) :: mean
61  mean=m
subroutine, public stat::reset ( )

Routine resetting the accumulators.

Definition at line 78 of file stat.f90.

78  m=0.d0
79  mprev=0.d0
80  v=0.d0
81  i=0
real(kind=8) function, dimension(0:ndim), public stat::var ( )

Function returning the variance.

Definition at line 66 of file stat.f90.

66  REAL(KIND=8), DIMENSION(0:ndim) :: var
67  var=v/(i-1)

Variable Documentation

integer stat::i =0
private

Number of stats accumulated.

Definition at line 20 of file stat.f90.

20  INTEGER :: i=0 !< Number of stats accumulated
real(kind=8), dimension(:), allocatable stat::m
private

Vector storing the inline mean.

Definition at line 23 of file stat.f90.

23  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: m !< Vector storing the inline mean
real(kind=8), dimension(:), allocatable stat::mprev
private

Previous mean vector.

Definition at line 24 of file stat.f90.

24  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: mprev !< Previous mean vector
real(kind=8), dimension(:), allocatable stat::mtmp
private

Definition at line 26 of file stat.f90.

26  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: mtmp
real(kind=8), dimension(:), allocatable stat::v
private

Vector storing the inline variance.

Definition at line 25 of file stat.f90.

25  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: v !< Vector storing the inline variance