Skip to content
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

Explicit conversion #238

Merged
merged 2 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/stdlib_stats_moment.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contains
return
end if

n = size(x, kind = int64)
n = real(size(x, kind = int64), ${k1}$)

if (present(center)) then
res = sum((x - center)**order) / n
Expand Down Expand Up @@ -58,7 +58,7 @@ contains
return
end if

n = size(x, kind = int64)
n = real(size(x, kind = int64), dp)

if (present(center)) then
res = sum((real(x, dp) - center)**order) / n
Expand Down Expand Up @@ -118,7 +118,7 @@ contains
return
end if

n = size(x, dim)
n = real(size(x, dim), ${k1}$)

res = 0
select case(dim)
Expand Down Expand Up @@ -193,7 +193,7 @@ contains
return
end if

n = size(x, dim)
n = real(size(x, dim), dp)

res = 0
select case(dim)
Expand Down Expand Up @@ -234,7 +234,7 @@ contains

real(${k1}$) :: n

n = count(mask, kind = int64)
n = real(count(mask, kind = int64), ${k1}$)

if (present(center)) then
res = sum((x - center)**order, mask) / n
Expand All @@ -259,7 +259,7 @@ contains

real(dp) :: n

n = count(mask, kind = int64)
n = real(count(mask, kind = int64), dp)

if (present(center)) then
res = sum((real(x, dp) - center)**order, mask) / n
Expand Down Expand Up @@ -309,7 +309,7 @@ contains
real(${k1}$) :: n${reduced_shape('x', rank, 'dim')}$
${t1}$, allocatable :: mean_${ranksuffix(rank-1)}$

n = count(mask, dim)
n = real(count(mask, dim), ${k1}$)

res = 0
select case(dim)
Expand Down Expand Up @@ -387,7 +387,7 @@ contains
real(dp) :: n${reduced_shape('x', rank, 'dim')}$
real(dp), allocatable :: mean_${ranksuffix(rank-1)}$

n = count(mask, dim)
n = real(count(mask, dim), dp)

res = 0
select case(dim)
Expand Down
8 changes: 4 additions & 4 deletions src/stdlib_stats_var.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contains
return
end if

n = size(x, kind = int64)
n = real(size(x, kind = int64), ${k1}$)
mean = sum(x) / n

#:if t1[0] == 'r'
Expand Down Expand Up @@ -57,7 +57,7 @@ contains
return
end if

n = size(x, kind = int64)
n = real(size(x, kind = int64), dp)
mean = sum(real(x, dp)) / n

res = sum((real(x, dp) - mean)**2) / (n - merge(1, 0, optval(corrected, .true.)))
Expand Down Expand Up @@ -161,7 +161,7 @@ contains
real(${k1}$) :: n
${t1}$ :: mean

n = count(mask, kind = int64)
n = real(count(mask, kind = int64), ${k1}$)
mean = sum(x, mask) / n

#:if t1[0] == 'r'
Expand All @@ -187,7 +187,7 @@ contains

real(dp) :: n, mean

n = count(mask, kind = int64)
n = real(count(mask, kind = int64), dp)
mean = sum(real(x, dp), mask) / n

res = sum((real(x, dp) - mean)**2, mask) / (n -&
Expand Down
2 changes: 1 addition & 1 deletion src/tests/stats/test_corr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ subroutine test_int64(x, x2)
, 'int64 check 1')
call check( ieee_is_nan(corr(x, 1, .false.))&
, 'int64 check 2')
call check( ieee_is_nan(corr(x, 1, x == 1.)), 'int64 check 3')
call check( ieee_is_nan(corr(x, 1, x == 1)), 'int64 check 3')
call check( abs(corr(x, 1, x < 5) - 1._dp) < dptol, 'int64 check 4')
call check( ieee_is_nan(corr(x, 1, x < -999)), 'int64 check 5')

Expand Down
2 changes: 1 addition & 1 deletion src/tests/stats/test_mean_f03.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program test_mean
use stdlib_error, only: check
use stdlib_kinds, only: sp, dp, int32, int64
use stdlib_kinds, only: sp, dp, int32
use stdlib_io, only: loadtxt
use stdlib_stats, only: mean
implicit none
Expand Down
2 changes: 1 addition & 1 deletion src/tests/stats/test_rawmoment.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program test_rawmoment
use stdlib_error, only: check
use stdlib_kinds, only: sp, dp, int32, int64
use stdlib_kinds, only: sp, dp, int32
use stdlib_stats, only: mean, moment
use,intrinsic :: ieee_arithmetic, only : ieee_is_nan
implicit none
Expand Down
2 changes: 1 addition & 1 deletion src/tests/stats/test_varn.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program test_varn
use stdlib_error, only: check
use stdlib_kinds, only: sp, dp, int32, int64
use stdlib_kinds, only: sp, dp, int32
use stdlib_stats, only: var
use,intrinsic :: ieee_arithmetic, only : ieee_is_nan
implicit none
Expand Down