@@ -11,7 +11,7 @@ workersactive,nworkersactive,workerrank,
11
11
nodenames,gethostnames,nprocs_node,
12
12
pmapsum,pmapreduce,pmap_onebatchperworker
13
13
14
- # The fundamental iterator that behaves like an Iterator.ProductIterator
14
+ # The fundamental iterator that behaves like an Iterator.Take{Iterator.Drop{Iterator. ProductIterator}}
15
15
16
16
struct ProcessorNumberError <: Exception
17
17
p :: Int
@@ -338,19 +338,19 @@ end
338
338
_infullrange (:: Tuple{} ,:: Tuple{} ) = true
339
339
340
340
# This struct is just a wrapper to flip the tuples before comparing
341
- struct LittleEndianTuple {T}
341
+ struct ReverseLexicographicTuple {T}
342
342
t :: T
343
343
end
344
344
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
347
347
348
348
function Base. in (val:: T ,ps:: ProductSplit{T} ) where {T}
349
349
_infullrange (val,ps) || return false
350
350
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 ])
354
354
355
355
first_iter <= val_lt <= last_iter
356
356
end
@@ -378,9 +378,9 @@ function whichproc(iterators::Tuple,val::Tuple,np::Int)
378
378
mid = floor (Int,(left+ right)/ 2 )
379
379
ps = ProductSplit (iterators,np,mid)
380
380
381
- if LittleEndianTuple (val) < LittleEndianTuple (first (ps))
381
+ if ReverseLexicographicTuple (val) < ReverseLexicographicTuple (first (ps))
382
382
right = mid - 1
383
- elseif LittleEndianTuple (val) > LittleEndianTuple (last (ps))
383
+ elseif ReverseLexicographicTuple (val) > ReverseLexicographicTuple (last (ps))
384
384
left = mid + 1
385
385
else
386
386
return mid
@@ -421,9 +421,9 @@ function indexinsplitproduct(ps::ProductSplit{T},val::T) where {T}
421
421
mid = floor (Int,(left+ right)/ 2 )
422
422
val_mid = @inbounds ps[mid]
423
423
424
- if LittleEndianTuple (val) < LittleEndianTuple (val_mid)
424
+ if ReverseLexicographicTuple (val) < ReverseLexicographicTuple (val_mid)
425
425
right = mid - 1
426
- elseif LittleEndianTuple (val) > LittleEndianTuple (val_mid)
426
+ elseif ReverseLexicographicTuple (val) > ReverseLexicographicTuple (val_mid)
427
427
left = mid + 1
428
428
else
429
429
return mid
0 commit comments