avoid failing self test
increase number of samples to have less corner cases. Needs to be allocatable to avoid stack/heap issue on ifort
This commit is contained in:
parent
fb51e3c4cd
commit
2f74e0d070
10
src/math.f90
10
src/math.f90
|
@ -1432,9 +1432,11 @@ subroutine selfTest
|
||||||
error stop 'math_LeviCivita'
|
error stop 'math_LeviCivita'
|
||||||
|
|
||||||
normal_distribution: block
|
normal_distribution: block
|
||||||
real(pReal), dimension(500000) :: r
|
integer, parameter :: N = 1000000
|
||||||
|
real(pReal), dimension(:), allocatable :: r
|
||||||
real(pReal) :: mu, sigma
|
real(pReal) :: mu, sigma
|
||||||
|
|
||||||
|
allocate(r(N))
|
||||||
call random_number(mu)
|
call random_number(mu)
|
||||||
call random_number(sigma)
|
call random_number(sigma)
|
||||||
|
|
||||||
|
@ -1443,11 +1445,11 @@ subroutine selfTest
|
||||||
|
|
||||||
call math_normal(r,mu,sigma)
|
call math_normal(r,mu,sigma)
|
||||||
|
|
||||||
if (abs(mu -sum(r)/real(size(r),pReal))>5.0e-2_pReal) &
|
if (abs(mu -sum(r)/real(N,pReal))>5.0e-2_pReal) &
|
||||||
error stop 'math_normal(mu)'
|
error stop 'math_normal(mu)'
|
||||||
|
|
||||||
mu = sum(r)/real(size(r),pReal)
|
mu = sum(r)/real(N,pReal)
|
||||||
if (abs(sigma**2 -1.0_pReal/real(size(r)-1,pReal) * sum((r-mu)**2))/sigma > 5.0e-2_pReal) &
|
if (abs(sigma**2 -1.0_pReal/real(N-1,pReal) * sum((r-mu)**2))/sigma > 5.0e-2_pReal) &
|
||||||
error stop 'math_normal(sigma)'
|
error stop 'math_normal(sigma)'
|
||||||
end block normal_distribution
|
end block normal_distribution
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue