Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arbitrarily offset tiling #25

Open
Luapulu opened this issue Nov 2, 2020 · 3 comments · May be fixed by #27
Open

Support arbitrarily offset tiling #25

Luapulu opened this issue Nov 2, 2020 · 3 comments · May be fixed by #27

Comments

@Luapulu
Copy link

Luapulu commented Nov 2, 2020

Currently only the last tile can be relaxed. What about adding a strategy RelaxEdgeTile, that allows offsetting the tile grid by an arbitrary offset?

@johnnychen94
Copy link
Member

Could you clarify what's the expected results with offset? Currently, there are two strategies after #23:

julia> A = rand(8);

julia> TileIterator(axes(A), RelaxLastTile((3, )))
3-element TileIterator{1,Tuple{TiledIteration.CoveredRange{StepRange{Int64,Int64},TiledIteration.LengthAtMost}}}:
 (1:3,)
 (4:6,)
 (7:8,)

julia> TileIterator(axes(A), RelaxStride((3, )))
3-element TileIterator{1,Tuple{TiledIteration.CoveredRange{TiledIteration.RoundedRange{LinRange{Float64}},TiledIteration.FixedLength}}}:
 (1:3,)
 (3:5,)
 (6:8,)

@Luapulu
Copy link
Author

Luapulu commented Nov 6, 2020

Ah yes, the idea is to return

(1:1,) # offset of 1
(2:4,)
(5:7,)
(8:8,)

For my purposes I’d only be interested in relaxing the last tile, but in principle this offset is independent of which if the two other strategies are used.

@johnnychen94
Copy link
Member

but in principle, this offset is independent of which if the two other strategies are used.

Yes, the following almost gives the expected result.

julia> A = rand(8);

julia> offset = 1
1

julia> R1 = TileIterator(map(r->r[begin:begin+1-offset],  axes(A)), (3, ))
1-element TileIterator{1,Tuple{TiledIteration.CoveredRange{StepRange{Int64,Int64},TiledIteration.LengthAtMost}}}:
 (1:1,)

julia> R2 = TileIterator(map(r->r[begin+offset:end],  axes(A)), (3, ))
3-element TileIterator{1,Tuple{TiledIteration.CoveredRange{StepRange{Int64,Int64},TiledIteration.LengthAtMost}}}:
 (2:4,)
 (5:7,)
 (8:8,)

But the logic seems a little bit more complicated for higher-dimensional cases; I guess recursion is needed. Also, it's not very clear to me where is the best place to add this functionality while still keep tiles lazily calculated. TileIterator(ax, strategy; offset=ntuple(_->0, length(ax)) might probably work but I'm not sure if this can be made performant.

@johnnychen94 johnnychen94 linked a pull request Dec 6, 2020 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants