JuliaArrays / JuliaArrays/BlockArrays.jl

Structure of blocks matrix lost on broadcast or `similar`

Open
#190 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
254
Forks
39
PR merge metrics
No merged PRs in 30d

Description

using BlocksArrays, NamedArrays
m1 = mortar(NamedArray([rand(i,j) for i=1:2, j=1:3], (x=["a","b"], y=["c","d","e"])))
m2 = mortar(NamedArray([rand(i,j) for i=1:2, j=1:3], (x=["a","b"], y=["c","d","e"])))

m1 .* m2  # 2×3-blocked 3×6 BlockMatrix{Float64}

The result does not have the named blocks of the original matrices (although NamedArray itself preserves names on broadcast).
similar(m1) also has the blocks but not the names, which I guess might be the source of the problem?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reproduction in the issue for m1 .* m2 and similar(m1), then trace the broadcast and similar entry points that construct the result. Compare their block structure and names with the original NamedArray inputs; done means both operations retain the named block structure described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.