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:
Martin Diehl 2021-12-30 21:53:00 +01:00
parent fb51e3c4cd
commit 2f74e0d070
1 changed files with 6 additions and 4 deletions

View File

@ -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