Skip to content

Commit

Permalink
remove init_pvals
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJereczek committed Oct 19, 2023
1 parent bc788c6 commit b6772d3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/significance/surrogates_significance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ function sliding_surrogates_loop!(
indicator_dummys, change_dummys,
width_ind, stride_ind, width_cha, stride_cha, tail
)
pval_right, pval_left = init_pvals(pval)
pval_right = zeros(length(pval))
pval_left = copy(pval_right)

# parallelized surrogate loop
Threads.@threads for _ in 1:n_surrogates
id = Threads.threadid()
Expand All @@ -164,7 +166,8 @@ function segmented_surrogates_loop!(
indicator, chametric, c, pval, n_surrogates, sgens,
indicator_dummys, change_dummys, width_ind, stride_ind, tail
)
pval_right, pval_left = init_pvals(pval)
pval_right = zeros(length(pval))
pval_left = copy(pval_right)
# parallelized surrogate loop
Threads.@threads for _ in 1:n_surrogates
id = Threads.threadid()
Expand All @@ -178,12 +181,6 @@ function segmented_surrogates_loop!(
choose_pval!(pval, pval_right, pval_left, tail)
end

function init_pvals(pval)
pval_right = zeros(length(pval))
pval_left = copy(pval_right)
return pval_right, pval_left
end

function accumulate_pvals!(pval_right, pval_left, tail, c, change_dummy)
if tail == :both || tail == :right
pval_right .+= c .< change_dummy
Expand Down

0 comments on commit b6772d3

Please sign in to comment.