Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 5c1b361

Browse files
committed
Make gl typestable
1 parent 264732f commit 5c1b361

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/statistics.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ autocor{T}(dv::DataVector{T}) = autocor(dv, 1)
2424
# Generate levels - see the R documentation for gl
2525
function gl(n::Integer, k::Integer, l::Integer)
2626
nk = n * k
27-
l % nk == 0 || throw(ArgumentError("length out must be a multiple of n * k"))
27+
d, r = divrem(l, nk)
28+
r == 0 || throw(ArgumentError("length out must be a multiple of n * k"))
2829
aa = Array(Int, l)
29-
for j = 0:(l/nk - 1), i = 1:n
30+
for j = 0:(d - 1), i = 1:n
3031
aa[j * nk + (i - 1) * k + (1:k)] = i
3132
end
3233
compact(PooledDataArray(aa))

0 commit comments

Comments
 (0)