-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile and run test_corr::test_sp
in stdlib/test/stats
#3603
Conversation
Please push https://github.com/czgdp1807/stdlib/tree/lf-stats-test forward, I had made progress here. |
I have made progress on this, will push on branch soon. |
@Pranavchiku I am already working on it. The problems with putting all the submodules into the Also the report is already submitted. So I would recommend do things right instead of creating an unmanageable mess. Once we run |
subroutine test_sp(x, x2)
real(sp), intent(in) :: x(:)
real(sp), intent(in) :: x2(:, :)
real(sp), allocatable :: y1(:, :), y2(:, :), y3(:, :), y4(:, :)
allocate(y1(size(x2, 2), size(x2, 2)), &
y2(size(x2, 1), size(x2, 1)), &
y3(size(x2, 2), size(x2, 2)), &
y4(size(x2, 1), size(x2, 1)))
integer :: yshape(2)
call check( abs(corr(x, 1) - 1._sp) < sptol&
, 'sp check 1')
call check( ieee_is_nan(corr(x, 1, .false.))&
, 'sp check 2')
call check( ieee_is_nan(corr(x, 1, x == 1.)), 'sp check 3')
call check( abs(corr(x, 1, x < 5) - 1._sp) < sptol, 'sp check 4')
call check( ieee_is_nan(corr(x, 1, x < -999)), 'sp check 5')
call check( any(ieee_is_nan(corr(x2, 1, mask = .false.)))&
, 'sp check 6')
call check( any(ieee_is_nan(corr(x2, 2, mask = .false.)))&
, 'sp check 7')
yshape(1) = size(x2, 2)
yshape(2) = size(x2, 2)
y1 = reshape([&
1._sp, 0.9994439103600_sp, -0.870544389237152_sp, 0.99944391036_sp,&
1._sp, -0.86261576629742_sp, -0.87054438923715_sp, -0.862615766297428_sp,&
1._sp ], yshape)
call check( all(abs(corr(x2, 1) - y1) < sptol)&
, 'sp check 8')
yshape(1) = size(x2, 1)
yshape(2) = size(x2, 1)
y2 = reshape([&
1._sp, 0.998742137866914_sp, 0.999846989517886_sp, -0.998337488459582_sp,&
0.998742137866914_sp, 1._sp, 0.999466429486246_sp, -0.99419162560192020_sp,&
0.999846989517886_sp, 0.999466429486246_sp, 1._sp, -0.99717646495273815_sp,&
-0.998337488459582_sp, -0.994191625601920_sp, -0.997176464952738_sp, 1._sp]&
,yshape)
call check( all( abs( corr(x2, 2) - y2) < sptol)&
, 'sp check 9')
call check( any(ieee_is_nan(corr(x2, 1, mask = x2 < 10)))&
, 'sp check 10')
yshape(1) = size(x2, 2)
yshape(2) = size(x2, 2)
y3 = reshape([&
1._sp, 0.981980506061965_sp, -1._sp&
,0.981980506061965_sp, 1._sp, -0.862615766297428_sp&
,-1._sp, -0.862615766297428_sp, 1._sp]&
,yshape)
call check( all( abs( corr(x2, 1, mask = x2 < 22) - y3) < sptol)&
, 'sp check 11')
! fails below. will make it work tomorrow.
yshape(1) = size(x2, 1)
yshape(2) = size(x2, 1)
y4 = reshape([&
1._sp, 0.998742137866914_sp, 0.999846989517886_sp, -1._sp&
,0.998742137866914_sp, 1._sp, 0.999466429486246_sp, -1._sp&
,0.999846989517886_sp, 0.999466429486246_sp, 1._sp, -1._sp&
,-1._sp, -1._sp, -1._sp, 1._sp]&
,yshape)
print *, "corr: ", corr(x2, 2, mask = x2 < 22), x2, x2 < 22
call check( all( abs( corr(x2, 2, mask = x2 < 22) - y4) < sptol)&
, 'sp check 12')
! call check( all(abs(corr(x2, 1, mask = x2 < 1000) - corr(x2, 1))&
! < sptol)&
! , 'sp check 13')
! call check( all(abs(corr(x2, 2, mask = x2 < 1000) - corr(x2, 2))&
! < sptol)&
! , 'sp check 14')
end subroutine test_sp Only the last test is remaining in this. Once it works then all other test types are similarly defined. So everything should be working. |
With a small work around, |
So I progressed as much as I could. I will fix the failing integration_tests (commented out in |
I have reproduced the segfault on my linux machine. Working on fixing it. |
So everything passes here. Now I will merge this and wrap it up. I will investigate the segfault a bit deeper tomorrow, just for knowing the cause. Since we have time at our hands now, so its a good opportunity to fix up
|
81df47d
to
7ea1450
Compare
…unwanted function)
test_corr
in stdlib/test/stats
test_corr::test_sp
in stdlib/test/stats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fine to merge, thanks for the fixes.
Work in Progress. Will continue on Monday and Tuesday next week.