Skip to content

Examples of mortar() for nd arrays? #414

@kescobo

Description

@kescobo

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}:
# ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions