Skip to content

Commit 080f3a1

Browse files
committed
renamed LittleEndianTuple to ReverseLexicographicTuple
1 parent 7a5820c commit 080f3a1

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/ParallelUtilities.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ workersactive,nworkersactive,workerrank,
1111
nodenames,gethostnames,nprocs_node,
1212
pmapsum,pmapreduce,pmap_onebatchperworker
1313

14-
# The fundamental iterator that behaves like an Iterator.ProductIterator
14+
# The fundamental iterator that behaves like an Iterator.Take{Iterator.Drop{Iterator.ProductIterator}}
1515

1616
struct ProcessorNumberError <: Exception
1717
p :: Int
@@ -338,19 +338,19 @@ end
338338
_infullrange(::Tuple{},::Tuple{}) = true
339339

340340
# This struct is just a wrapper to flip the tuples before comparing
341-
struct LittleEndianTuple{T}
341+
struct ReverseLexicographicTuple{T}
342342
t :: T
343343
end
344344

345-
Base.isless(a::LittleEndianTuple{T},b::LittleEndianTuple{T}) where {T} = reverse(a.t) < reverse(b.t)
346-
Base.isequal(a::LittleEndianTuple{T},b::LittleEndianTuple{T}) where {T} = a.t == b.t
345+
Base.isless(a::ReverseLexicographicTuple{T},b::ReverseLexicographicTuple{T}) where {T} = reverse(a.t) < reverse(b.t)
346+
Base.isequal(a::ReverseLexicographicTuple{T},b::ReverseLexicographicTuple{T}) where {T} = a.t == b.t
347347

348348
function Base.in(val::T,ps::ProductSplit{T}) where {T}
349349
_infullrange(val,ps) || return false
350350

351-
val_lt = LittleEndianTuple(val)
352-
first_iter = LittleEndianTuple(ps[1])
353-
last_iter = LittleEndianTuple(ps[end])
351+
val_lt = ReverseLexicographicTuple(val)
352+
first_iter = ReverseLexicographicTuple(ps[1])
353+
last_iter = ReverseLexicographicTuple(ps[end])
354354

355355
first_iter <= val_lt <= last_iter
356356
end
@@ -378,9 +378,9 @@ function whichproc(iterators::Tuple,val::Tuple,np::Int)
378378
mid = floor(Int,(left+right)/2)
379379
ps = ProductSplit(iterators,np,mid)
380380

381-
if LittleEndianTuple(val) < LittleEndianTuple(first(ps))
381+
if ReverseLexicographicTuple(val) < ReverseLexicographicTuple(first(ps))
382382
right = mid - 1
383-
elseif LittleEndianTuple(val) > LittleEndianTuple(last(ps))
383+
elseif ReverseLexicographicTuple(val) > ReverseLexicographicTuple(last(ps))
384384
left = mid + 1
385385
else
386386
return mid
@@ -421,9 +421,9 @@ function indexinsplitproduct(ps::ProductSplit{T},val::T) where {T}
421421
mid = floor(Int,(left+right)/2)
422422
val_mid = @inbounds ps[mid]
423423

424-
if LittleEndianTuple(val) < LittleEndianTuple(val_mid)
424+
if ReverseLexicographicTuple(val) < ReverseLexicographicTuple(val_mid)
425425
right = mid - 1
426-
elseif LittleEndianTuple(val) > LittleEndianTuple(val_mid)
426+
elseif ReverseLexicographicTuple(val) > ReverseLexicographicTuple(val_mid)
427427
left = mid + 1
428428
else
429429
return mid

test/runtests.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,27 +182,27 @@ end
182182
end
183183
end
184184

185-
@testset "LittleEndianTuple" begin
185+
@testset "ReverseLexicographicTuple" begin
186186
@testset "isless" begin
187-
a = ParallelUtilities.LittleEndianTuple((1,2,3))
188-
b = ParallelUtilities.LittleEndianTuple((2,2,3))
187+
a = ParallelUtilities.ReverseLexicographicTuple((1,2,3))
188+
b = ParallelUtilities.ReverseLexicographicTuple((2,2,3))
189189
@test a < b
190190
@test a <= b
191-
b = ParallelUtilities.LittleEndianTuple((1,1,3))
191+
b = ParallelUtilities.ReverseLexicographicTuple((1,1,3))
192192
@test b < a
193193
@test b <= a
194-
b = ParallelUtilities.LittleEndianTuple((2,1,3))
194+
b = ParallelUtilities.ReverseLexicographicTuple((2,1,3))
195195
@test b < a
196196
@test b <= a
197-
b = ParallelUtilities.LittleEndianTuple((2,1,4))
197+
b = ParallelUtilities.ReverseLexicographicTuple((2,1,4))
198198
@test a < b
199199
@test a <= b
200200
end
201201
@testset "equal" begin
202-
a = ParallelUtilities.LittleEndianTuple((1,2,3))
202+
a = ParallelUtilities.ReverseLexicographicTuple((1,2,3))
203203
@test a == a
204204
@test a <= a
205-
b = ParallelUtilities.LittleEndianTuple(a.t)
205+
b = ParallelUtilities.ReverseLexicographicTuple(a.t)
206206
@test a == b
207207
@test a <= b
208208
end

0 commit comments

Comments
 (0)