Loading...
Searching...
No Matches

Definition

Provides methods to compute mean, standard deviation and variance of a given sample.

Examples

use benchmark_statistics
type(stats) :: s
integer :: i
real(r8) :: array(10)
do i = 1, 10
array(i) = real(i, r8)
end do
call s%compute(array)
write(*, '(A)') str(s%mean, '(f12.3)') // ' ms'//' +/- '//str(s%stddev, '(f12.3)') // ' ms'

Remarks

The statistics computed at the moment are limited to mean, min, max and standard deviations. The implementation is quite naive and serve only the purpose of the current library.

Constructors

Initializes a new instance of the stats class

stats(integer, real(r8), real(r8), real(r8))

type(stats) :: s 

Examples

use benchmark_statistics
type(stats) :: s

Remarks

Definition at line 48 of file Statistics.f90.


The documentation for this type was generated from the following file:

Variables

real(r8), public mean = 0.0_r8
 Mean value of the sample.
real(r8), public min = 0.0_r8
 Minimal value of the sample.
real(r8), public max = 0.0_r8
 Maximal value of the sample.
real(r8), public stddev = 0.0_r8
 Standard deviation of the sample.
real(r8), public variance = 0.0_r8
 Variance of the sample.

Private Attributes

integer n
 Sample size.

Methods

◆ compute()

procedure, pass(this) compute ( class(stats), intent(inout) this,
real(r8), dimension(:), intent(in) y )

Compute mean, standard deviation and variance of a Type bound to the method.

Parameters
[in,out]thisbound argument
[in]ySample array

Examples

type(stats) :: s
integer :: i
real(r8) :: array(10)
call random_number(array)
call s%compute(array)
Note
At the moment it only works for real(r8) arrays

Remarks

Definition at line 57 of file Statistics.f90.