@@ -686,7 +686,7 @@ struct BlockInterlacer{DMS<:Tuple{Vararg{AbstractVector{Int}}}}
686686end
687687
688688
689- const TrivialInterlacer{d} = BlockInterlacer{<: NTuple{d,Ones{Int}} }
689+ const TrivialInterlacer{d,Ax } = BlockInterlacer{<: NTuple{d,Ones{Int,1,Tuple{Ax} }} }
690690
691691BlockInterlacer (v:: AbstractVector ) = BlockInterlacer (Tuple (v))
692692
@@ -732,23 +732,18 @@ function iterate(it::BlockInterlacer, (N,k,blkst,lngs))
732732 return iterate (it,(1 ,1 ,blkst,lngs))
733733 end
734734
735- Bnxtb = iterate (it. blocks[N],blkst[N]. .. ) # B is block size
735+ Bnxtb = iterate (it. blocks[N],blkst[N]. .. )
736736
737- if Bnxtb === nothing
737+ if Bnxtb === nothing || k > Bnxtb[ 1 ]
738738 # increment to next N
739739 return iterate (it,(N+ 1 ,1 ,blkst,lngs))
740740 end
741741
742- B,nxtb = Bnxtb
743-
744- if k > B
745- # increment to next N
746- return iterate (it,(N+ 1 ,1 ,blkst,lngs))
747- end
748-
749-
750742 lngs = Base. setindex (lngs, lngs[N]+ 1 , N)
751743 return (N,lngs[N]),(N,k+ 1 ,blkst,lngs)
752744end
753745
746+ iterate (it:: TrivialInterlacer{N,OneToInf{Int}} , st... ) where {N} =
747+ iterate (Iterators. product (1 : N, axes (it. blocks[1 ],1 )), st... )
748+
754749cache (Q:: BlockInterlacer ) = CachedIterator (Q)
0 commit comments