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

Examples of mortar() for nd arrays? #414

Open
kescobo opened this issue Aug 7, 2024 · 2 comments
Open

Examples of mortar() for nd arrays? #414

kescobo opened this issue Aug 7, 2024 · 2 comments

Comments

@kescobo
Copy link
Contributor

kescobo commented Aug 7, 2024

The docstring for mortar() shows

mortar(blocks::AbstractArray{R, N}, sizes_1, sizes_2, ..., sizes_N)

But I can't figure out how to use this. Here's what I expected to work:

julia> arr = [[rand(2,3,4)] [rand(2,3,4)]
              [rand(2,3,4)] [rand(2,3,4)]];

julia> typeof(arr)
Matrix{Array{Float64, 3}} (alias for Array{Array{Float64, 3}, 2})

julia> mortar(arr, [2,2], [3,3], ones(Int, 4))
ERROR: MethodError: no method matching mortar(::Matrix{Array{Float64, 3}}, ::Vector{Int64}, ::Vector{Int64}, ::Vector{Int64})

I was expecting this to produce the equivalent of

julia> BlockedArray(rand(4,6,4), [2,2], [3,3], ones(Int, 4))
2×2×4-blocked 4×6×4 BlockedArray{Float64, 3}:
# ...
@dlfivefifty
Copy link
Member

I suspect the docstring ia out of date or just wrong…

since you have an alternative that works is there any reason to want to use mortar? We should probably just delete that docstring.

@kescobo
Copy link
Contributor Author

kescobo commented Aug 12, 2024

you have an alternative that works

The alternative does not work for my use-case, or at least, I don't think so. This is related to #87, where the idea is that I have some images that need to be tiled together with some overlaps, and I want to mortar() together views of the original images, without needing to allocate a new array.

I'm currently getting around this by making a vector of 2D arrays, one for each layer, but it would be nice to be able to have a 3D blocked array instead. If there's a different way to use the BlockedArray() constructor for a group of existing 3D arrays, I'm happy to learn of it - all of my attempts have seemed to concatenate / copy the original arrays

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

No branches or pull requests

2 participants